Ok will this work?
$filename = "http://bf2web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
//$armynumbers."&vehicle=".$vehiclenumbers."&pid=".$pid."&info=".$infotoget.",rank";
ini_set("user_agent","GameSpyHTTP/1.0");
//the site or URL to get
$fp = curl_init($filename);
//set the options for the transfer
curl_setopt($fp, CURLOPT_HEADER, 0);
//execute the session
//curl_exec($ch);
Ok, do I still have to execute the curl session?
//$fp = fopen ($filename, "r");
if (!$fp) {
//Old Error Handler left incase someone wants it to do this instead of just reading the cache
/*$error = "BF2 Stats Site Down.";
$mode = error;
include("themes/baseline/theme.php");
exit;
*/
if (!file_exists($cachefilename)) {
$error = "BF2Web Down and no cache file exists.";
$mode = error;
include("themes/".$theme."/theme.php");
exit;
}
//read the cache for the stats
$xmlfile = @fopen($cachefilename, "r");
if (!$xmlfile) {
$error = "Error Reading $cachefilename";
$mode = "error";
include("themes/".$theme."/theme.php");
exit;
}
while(($xmlfile)) {
$xmldoc .= fread($xmlfile,4096);
}
fclose($xmlfile);
$thestats = xml2array($xmldoc);
//end code for reading stat cache
$namedstats = $thestats['stats'][0]['info'][0];
$namedawards = $thestats['stats'][0]['awards'][0];
$namedleader = $thestats['stats'][0]['leaderboard'][0];
$namedunlocks = $thestats['stats'][0]['unlocks'][0];
$namedmaps = $thestats['stats'][0]['maps'][0];
//end code for reading stat cache
} else {
$_xml ="1.0"?>rn rn rn";
while (($fp)) {
$content = fgets( $fp, 4096 );
//get names
if (ereg("Et107", $content) == true ) {
$error = "Error Invalid PID";
$mode = "error";
include("themes/".$theme."/theme.php");
exit;
}
if (ereg("Htpid", $content) == true ) {
$statnames = explode("t",$content); //load up the names of the stats so that they can be used for the naming of the array
}
//real stats
//start the first part of the xml file
if (ereg($pid, $content) == true ) {
$stats = explode("t",$content); //make the array with the stats
//it goes to one less than the count becuase the last one is one i added since the last one always gets messed up for some reason
//it also skips the first one because that is H (not a stat) from using explode it just picks this one up
for($i = 1; $i<count($stats)-1; $i++ ) {
$namedstats[$statnames[$i]] = "$stats[$i]"; //add the stat into a named array so its more easily configured.
//begin xml generation code
$_xml .="t ".$statnames[$i].">" . $stats[$i] . "".$statnames[$i].">rn";
}
}
}
//fclose ($fp);
//free up system resources !!IMPORTANT
curl_close($fp);
$_xml .=" rn rn";
}