Monthly Archives: January 2011

Get the Internet host name corresponding to a given IP address

This example will explain about how to get the domain name from the IP address.
Here goes the code:

<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);

echo $hostname;
?>