<?php
require __DIR__ . '/SourceQuery/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
$servers = array(
array(
'ip' => '',
'port' => ,
'engine' => SourceQuery::SOURCE,
'timeout' => 1,
),
array(
'ip' => '',
'port' => ,
'engine' => SourceQuery::SOURCE,
'timeout' => 1,
)
// далее добавляем сервера по аналогии
);
$Query = new SourceQuery();
$size = count($servers);
for ($i = 0; $i < $size; $i++) {
try {
$Query->Connect($servers[$i]['ip'], $servers[$i]['port'], $servers[$i]['timeout'], $servers[$i]['engine']);
$info = $Query->GetInfo();
} catch(Exception $e) {
echo $e->getMessage();
}
$Query->Disconnect();
echo $info['Players'].' / '.$info['MaxPlayers'];
}