Page 1 of 1

gethostbyaddr help please

Posted: Fri Jul 07, 2006 1:55 pm
by DimSum888
Hi everyone - i'm trying to use the function gethostbyaddr() but when i do so, the function always returns the IP address i passed in. In other words, it's failing.

Does anyone know if there is some kind of environment setting i need to turn on for this function to work correctly?

In case you're wondering, i'm using this function in it's most basic of situations:

Code: Select all

$remoteServer = gethostbyaddr($REMOTE_ADDR);
Any help is appreciated. Thanks!

Posted: Fri Jul 07, 2006 1:59 pm
by Ollie Saunders
have you tried it with an ip you definately knows exists like google or something?

Posted: Fri Jul 07, 2006 2:09 pm
by DimSum888
Yes, i've tried it with various IP's.

The ultimate goal is to determine infomation about the visitor (e.g. where they're from) but the first step is to obtain the host information. Something that is harder than i thought.

the PHP manual does not say what gethostbyaddr() relies on so i don't know if i need to have something turned on for this to work correctly. I'm running PHP Version 5.1.2 with Hardening-Patch 0.4.8.

Posted: Fri Jul 07, 2006 2:16 pm
by Ollie Saunders
the PHP manual does not say what gethostbyaddr() relies on so i don't know if i need to have something turned on for this to work correctly. I'm running PHP Version 5.1.2 with Hardening-Patch 0.4.8.
Yeah it does its not specific to each function but groups of them. See here.