Forum Moderators: coopster
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$string = $hostname;
preg_match('@^(?:http://)?([^/]+)@i', $string, $matches);
$host = $matches[1];
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
echo "Domain: " . $matches[0] . "\n";
Well, at least it will get indexed by Google! :)