How to find a domain name for an IP address?
To do this is easy in PHP as there is a built in function that accepts the IP address and will find the host name for you.
In order to do this, code like the below will help:
<?php
$ip = $REMOTE_ADDR;//capture IP
$domain = GetHostByName($ip);
?>
The variable $domain will now contain the hostname.
More website PHP Questions
How do I display todays date on my website?How do I find a visitors IP address?
How do I send HTTP headers with PHP?
How do I perform a 301 redirect with PHP?
How do I make sure an include file exists before loading the page?