Topic: [Script] Simple PvPGN & D2GS Status, using PHP
In case someone needs it:
<?php
// Inspired by https://github.com/pvpgn/phputils/blob/master/pvpgn-status/online-offline.php
$connect_server = FALSE;
$gaming_server = FALSE;
// BNETD
if($fp = @fsockopen('127.0.0.1', 6112, $error_number, $error_value, $timeout = 1)) {
fclose($fp);
$connect_server = TRUE;
}
// D2CS
if($fp = @fsockopen('127.0.0.1', 6113, $error_number, $error_value, $timeout = 1)) {
fclose($fp);
// D2DBS
if($fp = @fsockopen('127.0.0.1', 6114, $error_number, $error_value, $timeout = 1)) {
fclose($fp);
$a = 0;
$b = 0;
foreach(array('127.0.0.1') as $ip) {
$a++;
// D2GS
if($fp = @fsockopen($ip, 4000, $error_number, $error_value, $timeout = 1)) {
fclose($fp);
$b++;
$gaming_server = TRUE;
}
}
}
}
$status = 'Connect Server is ' . ($connect_server ? 'ONLINE' : 'OFFLINE') . ' and Gaming Server is ' . ($gaming_server ? 'ONLINE (' . $b . ' of ' . $a . ' servers running)' : 'OFFLINE') . '.';
echo $status;
?>
+1 Meanski