<?
$username="";
$password="F";
$database="";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$buffer = '';
//Put the file you want to read from below
$handle = fopen ("[URL unfurl="true"]http://war1.world-of-war.com/xmlshare/serverinfo.xml","r");[/URL]
while (!feof($handle)) {
//Adjust the number to be as small as possible. It specifies how many bytes you want to read in one line in the text file you're reading from. If you are reading from a large file then increase the value.
$buffer .= fgets($handle,1024);
}
fclose($handle);
$start = strpos($buffer,'<regPlayers>');
$end = strpos($buffer,'</regPlayers>');
$length = $end-$start;
$regplayers = substr($buffer, $start, $length);
$buffer = '';
//Put the file you want to read from below
$handle = fopen ("[URL unfurl="true"]http://war1.world-of-war.com/xmlshare/serverinfo.xml","r");[/URL]
while (!feof($handle)) {
//Adjust the number to be as small as possible. It specifies how many bytes you want to read in one line in the text file you're reading from. If you are reading from a large file then increase the value.
$buffer .= fgets($handle,1024);
}
fclose($handle);
$start = strpos($buffer,'<activePlayers>');
$end = strpos($buffer,'</activePlayers>');
$length = $end-$start;
$activeplayers = substr($buffer, $start, $length);
$buffer = '';
//Put the file you want to read from below
$handle = fopen ("[URL unfurl="true"]http://war1.world-of-war.com/xmlshare/serverinfo.xml","r");[/URL]
while (!feof($handle)) {
//Adjust the number to be as small as possible. It specifies how many bytes you want to read in one line in the text file you're reading from. If you are reading from a large file then increase the value.
$buffer .= fgets($handle,1024);
}
fclose($handle);
$start = strpos($buffer,'<deadPlayers>');
$end = strpos($buffer,'</deadPlayers>');
$length = $end-$start;
$deadplayers = substr($buffer, $start, $length);
$buffer = '';
//Put the file you want to read from below
$handle = fopen ("[URL unfurl="true"]http://war1.world-of-war.com/xmlshare/serverinfo.xml","r");[/URL]
while (!feof($handle)) {
//Adjust the number to be as small as possible. It specifies how many bytes you want to read in one line in the text file you're reading from. If you are reading from a large file then increase the value.
$buffer .= fgets($handle,1024);
}
fclose($handle);
$start = strpos($buffer,'<gameTime>');
$end = strpos($buffer,'</gameTime>');
$length = $end-$start;
$gametime = substr($buffer, $start, $length);
print "REGPLAYERS= $regplayers<br />ACTIVEPLAYERS= $activeplayers <br />DEADPLAYERS= $deadplayers <br />GAMETIME= $gametime<br />";
$query =
"INSERT INTO stats
(
id, regplayers, activeplayers, deadplayers
)
VALUES
(
'', $regplayers, $deadplayers, $activeplayers
)";
$sql = mysql_query($query) or die("Invalid query: " . mysql_error());
mysql_close();
?>