vakacjus
Lua & C++ Study.
- Joined
- Oct 23, 2008
- Messages
- 255
- Solutions
- 1
- Reaction score
- 26
Can someone help me with this script?:
Thats is a serverstatus.php file.
Maybe someone help me, because it's didn't not work.
Code:
<?PHP
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$config_ini = parse_ini_file('../../config/config.ini');
$server_config = parse_ini_file($config_ini['server_path'].'config.lua');
$info = chr(6).chr(0).chr(255).chr(255).'info';
flush();
$sock = @fsockopen("127.0.0.1", $server_config['port'], $errno, $errstr, 1);
if ($sock) {
fwrite($sock, $info);
$data='';
while (!feof($sock))
{
$data .= fgets($sock, 1024);
}
fclose($sock);
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
echo '<response>'.$matches[1].'</response>';
}
else
{
echo '<response>OFF</response>';
}
?>
Thats is a serverstatus.php file.
Maybe someone help me, because it's didn't not work.
Code:
Błąd parsowania XML: niezrozumiała seria znaków po elemencie dokumentu Obszar: http://83.8.102.83/layouts/iceskull/ajax/server_status.php Numer linii: 2, kolumna 1:
Players Online