Allow host IP using PHP

How can I resolve the hostname IP address using PHP?

+6
php
source share
4 answers

You can use the gethostbyaddr () function.

$hostname = gethostbyaddr($ipAddress); 
+13
source share

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.

+5
source share
+2
source share

You must give gethostbyaddr () a shot.

0
source share

All Articles