gethostbyaddr help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DimSum888
Forum Newbie
Posts: 2
Joined: Fri Jul 07, 2006 1:50 pm

gethostbyaddr help please

Post 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!
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

have you tried it with an ip you definately knows exists like google or something?
DimSum888
Forum Newbie
Posts: 2
Joined: Fri Jul 07, 2006 1:50 pm

Post 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.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
Post Reply