Revision: 26676
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 6, 2010 07:53 by jackoder
Initial Code
<?
# Domain Name
$domainName = "http://www.snipplr.com" ;
function DomainCheck($domainName){
$startTime = microtime(true);
$openDomain = fsockopen ($domainName, 80, $errno, $errstr, 10);
$finishTime = microtime(true);
$serverStatus = 0;
if (!$openDomain) $serverStatus = -1;
else {
fclose($openDomain);
$status = ($finishTime - $startTime) * 1000;
$serverStatus = floor($serverStatus);
}
return $serverStatus;
}
$serverStatus = DomainCheck($domainName);
# Print
if ($serverStatus != -1) {
echo "Cannot reach the server!" ;
} else {
echo "Server's running well." ;
}
?>
Initial URL
Initial Description
Hello Php Coders, Here's a useful php code block for your projects to control server status. Use this code blokc to report a server status result. I hope you'll like it. Also; i suggest you to rest for a while on [2 KiÅŸilik Oyunlar](http://www.ikikisilikoyunlar.net) and [Oyunlar](http://www.cilekoyun.com) sites to fun. I think you'll like them. I wish you success on your profect and i hope everything'll be best for us. Best codings!
Initial Title
Check Server Status with PHP
Initial Tags
php, server
Initial Language
PHP