Google Result
<?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;
}
?>
Returns the Time it took to ping the server.
http://www.tutcity.com/view/check-your-server-status-a-basic-ping.10248.html
To Check if a domain is avaiable:
<?php
function checkDomain($domain,$server,$findText){
// Open a socket connection to the whois server
$con = fsockopen($server, 43);
if (!$con) return false;
// Send the requested doman name
fputs($con, $domain."\r\n");
// Read and store the server response
$response = ' :';
while(!feof($con)) {
$response .= fgets($con,128);
}
// Close the connection
fclose($con);
// Check the response stream whether the domain is available
if (strpos($response, $findText)){
return true;
}
else {
return false;
}
}
?>
$status = checkDomain("stackoverflow.com",'whois.crsnic.net','No match for');