note 94807 modified in function.gethostbyaddr by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 Nov 2009 21:00:54 +0000 |
| Subject: | note 94807 modified in function.gethostbyaddr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163290@lists.php.net to get a copy of this message | ||
DNS lookup with timeout on a Mac:
<?php
function dns_timeout($ip)
{
$res=
nslookup -timeout=2 -retry=1 $ip;
if (preg_match('/name = (.*).\n/', $res, $out))
{
return $out[1];
} else
{
return $ip;
}
}
?>
--was--
DNS lookup with timeout on a Mac:
function dns_timeout($ip)
{
$res=nslookup -timeout=2 -retry=1 $ip;
if (preg_match('/name = (.*).\n/', $res, $out))
{
return $out[1];
} else
{
return $ip;
} }
http://php.net/manual/en/function.gethostbyaddr.php