addServer([
'type' => 'dayz',
'host' => '82.64.214.194:3202',
'options' => [
'query_port' => 27022,
],
]);
// Define the servers you wish you query
//$GameQ = new \GameQ\GameQ(); // or //$GameQ = \GameQ\GameQ::factory();
$GameQ->setOption('timeout', 3); // 3 seconds
$results = $GameQ->process();
//print_r($results);
//echo "
// var dump
";
//var_dump(json_decode($readjson, true));
//echo " // echo
";
// echo $readjson
";
//$data1 = json_decode("$readjson", true);
//echo "//Print data1
" ;
//print_r($data1);
echo "
";
$data = json_decode($readjson);
// class
$name = $data->{'name'};
$map = $data->{'map'};
$password = $data->{'password'};
$game = $data->{'raw'}->{'game'};
$secure = $data->{'raw'}->{'secure'};
$numplayers = $data->{'raw'}->{'numplayers'};
$version = $data->{'raw'}->{'version'};
$tags = $data->{'raw'}->{'tags'};
//$dedicated = $data->{'raw'}->{'rules'}->{'dedicated'};
//$island = $data->{'raw'}->{'rules'}->{'island'};
$connect = $data->{'connect'};
$ping = $data->{'ping'};
$time = "$tags[38]$tags[39]:$tags[41]$tags[42]";
$battleye = substr($tags,0,8);
$hive = substr($tags,18,8);
$players = $data->{'players'};
//if(empty($players))
// $players = "0";
//if (empty($players)) { "0"; }
//$playersuser = substr($players,0,8);
//$players = $data->{'array_filter($players)'};
//$player = $data->{'players'};
7
?>
Dayz ToX Server:
|
Server Name | IP server | Ping | Time | Player Info | Joueurs | Version | Battleye |
|
|
| | |
|
| |
|
| Players Info | Debug |
Name |
| print_r ";print_r($players);
?>
|
";
echo "
Resultat
";
echo "
Server Name: ${name} \n";echo "
";
echo "Map: ${map}
";
echo "Game: ${game}
";
echo "IP: ${connect}
";
echo "Secure: ${secure}
";
echo "Version: ${version}
";
//echo "Island: ${island}
";
//echo "dedicated: ${dedicated}
";
echo "Ping: ${ping}
";
echo "Time: $time
";
echo "Nombre Joueurs: ${numplayers}
";
echo "Players: "; if(count($players) == 1) {echo "il y a des joueurs"; } else {echo "0 player" ;}
echo "
";
echo "Tags: ($tags)"; //printf("[%0.45s]
",$tags); //print_r($tags);
echo "
hive: ${hive}
";
echo "Battleye: ${battleye}";
echo "
";
?>