Category Archives: How to get the domain name from given IP address

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;
?>