I use this function a lot.
($ip, $hostname) = &go_names( $host );
$host is either a hostname or an ip ...
&go_names attempts to fill $ip and $hostname
with an IP and a canonical hostname
(using A's and PTR's where possible).
Note: This function is desinged for use with names
and addresses that forward and reverse lookup the same
and that only have one ip address. I mainly use this
function for resolving names and IPs in network monitoring
apps (that I can't release here).
jcwren attempted to
do lookups on www.yahoo.com which has 9 or 10 IPs.
Worse, www.yahoo.com is a CNAME. I installed
no CNAME support at all. Also, please don't use the '-w'
with this one. The latest versions of Net::DNS seem
to use a bunch of depreciated thingies. |