<?
// filtering the url
function splitaddr($quickurl)
{
	if(strstr($quickurl,"/"))
	{
	 $quickurl = substr($quickurl, 0, strpos($quickurl, "/"));
	}

	return $quickurl;
}

// status for url in main server
function checkurl($link,$port)
{

	 $nError=0;
			$t = microtime();
                        
			$url = @fsockopen($link, $port, &$errno, &$errstr, 10);// or die("Unable To Open Socket with URL $link Port $port");
			$t1 = microtime();
			list($ms,$s) = explode(' ',$t);
			$t = ((float)$s+(float)$ms);
			list($ms,$s) = explode(' ',$t1);
			$t1 = ((float)$s+(float)$ms);
			$t1=$t1-$t;
             if (!$url)
			 $rturn = array("Failed",number_format($t1,4,'.',''));
			 else
			 $rturn = array("Ok",number_format($t1,4,'.',''));


             @fclose($url);
         return $rturn;
}




?>
