gethostbyaddr(),gethostbyname() functions:
gethostbyname() :string gethostbyname ( string hostname) — Returns the IP address of the Internet host specified by hostname.
string gethostbyname ( string hostname) — Returns the IP address of the Internet host specified by .Example :
<?php
echo $ip = gethostbyname(”localhost”); // will give ip address of the internet host
$iplist = gethostbynamel(”localhost”);
// will give the list of ip addresses corresponding to the given internet host
print_r($iplist);
?>
gethostbyaddr() :gethostbyaddr — Get the Internet host name corresponding to a given IP address
gethostbyaddr — Get the Internet host name corresponding to a given IP addressExample :
<?php
$hostname = gethostbyaddr($_SERVER[’REMOTE_ADDR’]);
echo $hostname;
?>
