Category Archives: How to get the IP from domain name

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