I'm making a server status checker for a game, and it mostly works. But, it always displays as offline. Here is my code.
<?php
$status = GetServerStatus('24.68.198.193',43594); // IP or Hostname Goes Here
function GetServerStatus($site, $port) {
$fp = @fsockopen($site, $port, $errno, $errstr, 2);
if (!$fp) {
$imagepath="off.png"; //OFFLINE IMAGE LINK!
$image=imagecreatefrompng($imagepath);
header('Content-Type: image/png');
imagepng($image);
} else { //ONLINE Status
$imagepath="on.png"; //ONLINE IMAGE LINK!
$image=imagecreatefrompng($imagepath);
header('Content-Type: image/png');
imagepng($image);
}
}
?>
I made sure 43594 port was open and that the IP was correct
http://www.dcfilms.org/status.php
Thanks in advance!