
These functions are used to translate IP addresses into domain names and vice versa. To convert from an IP address to a domain name use gethostbyaddr("IP"). And to convert from a domain name to an IP address use gethostbyname("domain.name").
Example.
Convert the IP address 18.159.0.42 into its domain name. To do this we
execute the following command:
<?echo
gethostbyadrr("18.159.0.42")>
The result is: AENEAS.MIT.EDU
And to convert from an address like www.yahoo.com to its IP address we
execute this command:
<?echo
gethostbyname("www.yahoo.com")>
The result is: 205.216.146.69