im trying to use one of these pages: Game Server Search, Player Search, Server List, Stats, and Rankings
the code im using is:
while (strpos($contents, '<tr>'))
{
$start = strpos($contents, '<tr>');
$end = strpos($contents, '</tr>', $start) + 5;
$rstring = substr($contents, $start, $end - $start);
$contents = str_replace($rstring, '', $contents);
//nameee
$start = strpos($rstring, '[clantag]');
$end = strpos($rstring, '</a>', $start);
$name= trim(substr($rstring, $start, $end - $start));
echo $name . '<br/>';
//players
$search = '<td class="c05 item_bgcolor_even">';
$start = (strpos($rstring, $search) + strlen($search));
$end = strpos($rstring, "</td>", $start);
$players= trim(substr($rstring, $start, ($end - $start)));
echo $players . '<br />';
$map;
$curPlayers;
$maxPlayers;
$ip;
}
It gets the server name correctly but when it comes to players, one line i get them and the other I get lor_odd"> 1230.
Edit: I just dropped this and found a better way using DOMParser instead.
Edited by dmanjrod, 18 June 2011 - 09:22 AM.


Sign In
Create Account

Back to top









