Need Help Making Sataus Checker

coolv1994

Member
Messages
508
Reaction score
0
Points
16
Ok I've tried for about a week or so tring to make a server status checker using fsocketopen() and all that does is tell me if my no-ip is portforwarded. I was wondering if someone could help me make a status checker that will check the port and will ping my server like RuneLocus does. It is a private server that is ran with Java and uses the port 43594. If anyone has an idea please help.
 

supajason

Member
Messages
288
Reaction score
2
Points
18
Source: http://www.phptoys.com/e107_plugins/content/content.php?content.41

PHP:
<?php

// Function to check response time
function pingDomain($domain){
    $starttime = microtime(true);
    $file      = fsockopen ($domain, 80, $errno, $errstr, 10);
    $stoptime  = microtime(true);
    $status    = 0;

    if (!$file) $status = -1;  // Site is down
    else {
        fclose($file);
        $status = ($stoptime - $starttime) * 1000;
        $status = floor($status);
    }
    return $status;
}
?>
 
Top