Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

gethostbyname & gethostbyaddr

Given a hostname on a shared server the gethostbyaddr will obviously return the 'master' hostname. Here I pass gethostbyname('www.corx.net'), and then the returned IP address to gethostbyaddr.

$ip = gethostbyname('www.corx.net');

IP address for www.corx.net is 64.190.63.222

$hostname = gethostbyaddr(64.190.63.222);

hostname for IP address 64.190.63.222 is 64.190.63.222

See also PHP checkdnsrr and PHP gethostbyname & gethostbyaddr - Googlebot check.

Share this!