After running my code I get results as follows:
Highest Skill - 29 (#79852)
Total EXP - 299 (#62976)
This is fine except I want to only have it display:
Highest Skill - 29
Total EXP - 299
So for some reason I cannot seem to strip out what I need.
<?php
$url = "http://www.halo3leaderboard.com/ManHands14";
$raw = file_get_contents($url);
$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");
$content = str_replace($newlines, "", html_entity_decode($raw));
//$start = strpos($content,'<table cellpadding="2" class="standard_table"');
$start = strpos($content,'<table class="DataDisplay" width="100%" border="0" cellspacing="0" cellpadding="0">');
//$end = strpos($content,'</table>',$start) + 8;
$end = strpos($content,'<td valign="center"><div align="left" class="White8ptTxt_Bold">Social Kills</div></td>',$start) + 8;
$table = substr($content,$start,$end-$start);
preg_match_all("|<tr(.*)</tr>|U",$table,$rows);
foreach ($rows[0] as $row){
if ((strpos($row,'<th')===false)){
preg_match_all("|<td(.*)</td>|U",$row,$cells);
$title = strip_tags($cells[0][0]);
$rank = strip_tags($cells[0][1]);
$new_rank = preg_replace('/\s\(#\d+\)$/', '', $rank);
$position = strip_tags($cells[0][2]);
echo "{$title} - {$new_rank}<br>\n";
}
}
?>
Any thoughts?