Re: IP Addesses on local network

From: Date: Mon, 03 Mar 2003 11:29:19 +0000
Subject: Re: IP Addesses on local network
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137871@lists.php.net to get a copy of this message
> echo gethostbyaddr("ip.number.inserted.here"); > > returns the name of the server when it`s an internet address. > Is there a similar command that will return host names on a local > network.... > > I tried using the above command putting in a LAN address, but it just > returned the IP address..... This isn't a PHP issue, this is a DNS issue. "gethostbyaddr" uses DNS resolution to convert the IP address into its named equivelant... if no name is found, it will return the IP address again. The only way to get the reverse DNS for a private (LAN) IP address is to use a DNS server which has those IPs registered. In short, you have to run your own domain name server and apply the entries in there. There are other, OS independant, ways of adding these lookups (eg: /etc/hosts on Unix %SYSTEMROOT%\system32\hosts.pam (I think) on Windows 2000+) but you will have to investigate those yourself. -- Dan Hardiker [dhardiker@staff.firstcreative.net] ADAM Software & Systems Engineer First Creative

« previous php.general (#137871) next »