OK, below is some code that takes the "rating" off that page.
PHP Code:
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$starttime = getmicrotime();
$t = time();
$url = "http://aom.stats.zone.msn.com/AOM_RC0/query/query.aspx";
$q = "<?xml%20version=\"1.0\"?><clr><cmd%20v=\"query\"/>";
$q .= "<co%20g=\"AOM_RC0\"%20s=\"100\"%20z=\"1.0.3\"%20t=\"".$t."\"%20U=\"6\"/>";
$q .= "<qer%20id=\"0\"%20np=\"0\"%20nn=\"20\"%20si=\"0\"%20et=\"ZS_Human\"%20md=\"ZS_Supremacy\"%20rn=\"ZS_TopPlayers\"%20tp=\"ZS_AllTime\"/>";
$q .= "</clr>";
$top20 = array();
$rdf = parse_url($url);
$fp = fsockopen($rdf['host'], 80, $errno, $errstr, 30);
if (!$fp) {
echo "Problem loading ESO Stats Data";
return;
}
if ($fp) {
fputs($fp, "GET " . $rdf['path'] . "?" . $q . " HTTP/1.0\r\n");
fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
$string = "";
$pagetext = "";
while(!feof($fp)) {
$pagetext .= chop(fgetc($fp));
}
fputs($fp,"Connection: close\r\n\r\n");
fclose($fp);
$string = chop($pagetext);
$items = explode("\"",$string);
$lines = count($items);
$offset = 1;
for ($i=23;$i<$lines;$i+=12) {
$top20[$offset]["name"] = $items[$i];
$top20[$offset]["rank"] = $items[$i+2];
$top20[$offset]["rating"] = intval($items[$i+6]);
$offset++;
}
## Hint: Changing the "6" below to a larger number will increase the number of players displayed. Max. = 20 ##
for ($j=1;$j<2;$j++) {
$rating .= $top20[$j]["rating"];
}
}
Maybe that better illustrates what Im trying to do. Now, I did NOT by any means write that code. I found it, and modified it to do what I need.
2 things:
1- What extranious things can I remove from that code, so its more streamlined? Can I 86 the microtime stuff?
2- Where in global.php should I put the finished code, so that I can pull $rating and have it show up wherever I put that variable?
Thanks alot for the help guys.
/DJ