|
[Edit] Check Server Status with PHP
you can use in your projects to control server status # Domain Name
$domainName = "http://www.google.com" ;
# Function
function DomainCheck($domainName){
$startTime = microtime(true);
$openDomain = fsockopen ($domainName, 80, $errno, $errstr, 10);
$finishTime = microtime(true);
$serverStatus = 0;
# Control Structure
if (!$openDomain) $serverStatus = -1;
else {
fclose($openDomain);
$status = ($finishTime - $startTime) * 1000;
$serverStatus = floor($serverStatus);
}
return $serverStatus;
}
# Server Status
$serverStatus = DomainCheck($domainName);
# Result
if ($serverStatus != -1) {
echo "Server is OFF right now" ;
} else {
echo "Server is ON; everyhing is OK." ;
}
|
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
© Advanced Web Core. All rights reserved

