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