You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm looping through an array of servers to check the status of each and then i build a page. when a server is online the object contains all of the fields the server offers.
when a server is offline the object still contains an empty field with the value NULL, a software field with the value "Vanilla", and an online field with a value of int(1). regardless of the server status when using query it appears the server is always online == 1.
The text was updated successfully, but these errors were encountered:
for ($x = 0; $x < $arrlength; $x++) {
try {
include_once 'MinecraftServer.php';
$server = new MinecraftServer($servers[$x]->qhost, $servers[$x]->qport, 1);
} catch (Exception $e) { }
//var_dump($server->getInfoArray());
$online = $server && $server->online == 1 && $server->hostname;
//generating some html here
}
There's an array of arrays ($servers) that hold the server values. Every check returns a value of online == 1 so I simply added a check for the hostname which was only populated when a server was really online. I've worked around it but I'm reporting the issue so you can fix the underlying cause if you want.
Also, as a side note, I don't know if the library or vanilla php supports more granular timeouts but the minimum 1 second is a really long time when checking local servers. I would prefer to fail out at 50ms or even 25ms so that the page can load faster. The response when the server is up will always come back in less than 1ms and never come back if it's down. Just throwing that out there in case you improve the library.
i'm looping through an array of servers to check the status of each and then i build a page. when a server is online the object contains all of the fields the server offers.
when a server is offline the object still contains an empty field with the value NULL, a software field with the value "Vanilla", and an online field with a value of int(1). regardless of the server status when using query it appears the server is always online == 1.
The text was updated successfully, but these errors were encountered: