Okay, so I've looked at it for a while, and still can't see what's going wrong. I know for a FACT that the regex works. You can double check it yourself. I downloaded RegExEditor from PHPEdit.net and plugged in some information. The resulting matche(s) were what we want, but it just won't show in PHP. Not sure why.... Here's the code I have been using:
<?php
if(!isset($_GET['id']))
{
$_GET['id'] = '79894';
}
// Get the webpage HTML code...
$url = 'http://forums.nintendo.com/nintendo/view_profile?user.id='.$_GET['id'];
$handle = fopen($url, "r");
$contents = file_get_contents($url);
fclose($handle);
// Find a good starting spot for the HTML code. The User Information table row
// should suit just fine....
$start = strpos($contents, '<tr><td class="subjectbar" colspan="2">User Information</td></tr>');
// Now, find a point after the start that is past the post count,
// the search-bar declaration should be fine
$end = strpos($contents, '<tr><td colspan="2" class="searchbar">', $start);
// Now, cut the extra text from around the start and end positions....
$contents = substr($contents, $start, $end-$start);
$contents = str_replace("\n", "", $contents);
// Define the rank pattern...
$p_rank = "#<tr><td class=\"cell_2\"><span class=\"title\">Rank<\/title><\/td><td class=\"cell_2\"><span class=\"title_big\">([a-zA-Z0-9.]*)<\/span><\/td><\/tr>#";
// Define the post pattern...
$p_post = "#<tr><td class=\"cell_2\"><span class=\"title\">Total Posts<\/span><\/td><td class=\"cell_2\">([0-9.]*)<\/td><\/tr>#";
// Get both the rank & post count back into their respective arrays....
preg_match_all($p_rank, $contents, $rank);
echo '<pre><strong>Rank:</strong><br>';
var_dump($rank);
echo '<hr /><strong>Posts:</strong><br>';
preg_match_all($p_post, $contents, $post);
var_dump($post);
echo '</pre>';
echo '<hr><hr>';
?>
The regular expressions are:
/<tr><td class=\"cell_2\"><span class=\"title\">Rank<\/title><\/td><td class=\"cell_2\"><span class=\"title_big\">([a-zA-Z0-9.]*)<\/span><\/td><\/tr>/
/<tr><td class=\"cell_2\"><span class=\"title\">Total Posts<\/span><\/td><td class=\"cell_2\">([0-9.]*)<\/td><\/tr>/
Now, what they say is this:
Look for a place in the string that contains:
<tr><td class=\"cell_2\"><span class=\"title\">Rank<\/title><\/td><td class=\"cell_2\"><span class=\"title_big\">
Then look for any amount of letters, numbers, spaces after that until we see:
<\/span><\/td><\/tr>
Anything in between those two items, we want. Return it to an array. Same thing goes with the other one. FOr some odd reason, it works perfectly but not in PHP.
Perhaps someone could shed some more light....
~Brett