Use gethostbyaddr ()
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo $hostname;
You may find that this function may freeze for some time when the address is not found - if this becomes a performance issue for you, check out this comment on the manual , which details the manual method that supports timeout.
Paul dixon
source share