Jump to content

Server Status Info?


random1

Recommended Posts

Thanks I create the following function.

 

function pingDomain($domain = "10.1.1.1", $port = "80"){

 

try

{

$starttime = microtime(true);

$file = fsockopen ($domain, $port, $errno, $errstr, 10);

$stoptime = microtime(true);

$status = 0;

}

catch(Exception $e)

{

// Exception occured pinging domain

}

 

if (!$file) $status = -1;  // Site is down

else {

fclose($file);

$status = ($stoptime - $starttime) * 1000;

$status = floor($status);

$this->setServerStatus($status);

}

// Else site is up

$this->setServerStatus($status);

return $status; // ping in ms

}

Link to comment
https://forums.phpfreaks.com/topic/90849-server-status-info/#findComment-465661
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.