function whois($query, $server='whois.networksolutions.com', $port=43)
{
$query = strtolower(str_replace(array('www.','http://'), array('',''), $query));
$f = @fsockopen($server,$port);
if(!$f)
{
return '';
}
$result = '';
fputs($f,"$query\r\n");
while(!feof($f))
{
$result.=fgets($f,128);
}
fclose($f);
return $result;
}
function expiration_date($domain)
{
$res = whois($domain);
$arr = explode("\n", $res);
for($i=0; $i<count($arr); $i++)
{
$pos = strpos($arr[$i],'Record expires on ');
if($pos !== false)
{
$str = substr($arr[$i],$pos+18,11);
return $str;
}
}
return '';
}