gethostbyaddr() returns only numerical IPs :(
Posted: Mon Jul 19, 2004 11:59 am
Hi all,
I am trying to resolve IP addresses into their hostnames using gethostbyaddr().
The weird thing is that I get different results if I run php from a shell than if I access the script through the web server.
More specifically, the following lines in an executable file:
#!/usr/local/bin/php
<?
print( gethostbyaddr( "198.182.196.56" ) );
?>
... will print out "www.linux.org". If I stick the <?...?> block into a .php file and access it through my browser, I get "198.182.196.56".
I'm pretty lost here.... any suggestions appreciated.
I'm running Apache 1.3.29, mod_php 4.3.4 statically linked, FreeBSD 5.2
thanks
antoine
I am trying to resolve IP addresses into their hostnames using gethostbyaddr().
The weird thing is that I get different results if I run php from a shell than if I access the script through the web server.
More specifically, the following lines in an executable file:
#!/usr/local/bin/php
<?
print( gethostbyaddr( "198.182.196.56" ) );
?>
... will print out "www.linux.org". If I stick the <?...?> block into a .php file and access it through my browser, I get "198.182.196.56".
I'm pretty lost here.... any suggestions appreciated.
I'm running Apache 1.3.29, mod_php 4.3.4 statically linked, FreeBSD 5.2
thanks
antoine