I have a script that analyzes my apache log files. I use gethsotbyaddr() to find the alpha version of ip addresses. It works about 50% of the time. Otherwise it returns the numeric ip address. If I run whois on the same ip address I
usually get an answer. One example that I just saw that does not work is baidu. Is there a way to get gethostbyaddr() to work better? I was even thinking of abandoning gethostbyaddr() and spawning whois instead.
thanks,
William
Why doesn't gethostbyaddr() work?
Moderator: General Moderators
Re: Why doesn't gethostbyaddr() work?
I've narrowed the question down.
Does this work on your system:
$name = gethostbyaddr("74.125.75.1");
When I run this it returns "74.125.75.1".
Whois shows that it is Google. Yet gethostbyaddr() works for thousands of other ip addresses. There are a few like this one that just don't work.
Any ideas?
William
Does this work on your system:
$name = gethostbyaddr("74.125.75.1");
When I run this it returns "74.125.75.1".
Whois shows that it is Google. Yet gethostbyaddr() works for thousands of other ip addresses. There are a few like this one that just don't work.
Any ideas?
William
Re: Why doesn't gethostbyaddr() work?
I guess whois returns to whom the IP is registered
and gethostbyaddr use Reverse DNS to return the host name
And the fact that IP is registered by Google does not mean that it have a hostname
and gethostbyaddr use Reverse DNS to return the host name
And the fact that IP is registered by Google does not mean that it have a hostname
- mrvijayakumar
- Forum Commoner
- Posts: 58
- Joined: Tue Aug 18, 2009 12:39 am
- Location: Chennai city, India
- Contact:
Re: Why doesn't gethostbyaddr() work?
Hi dear,
Read this article for more, http://in2.php.net/gethostbyaddr. U can also find some related functions tooo.
Read this article for more, http://in2.php.net/gethostbyaddr. U can also find some related functions tooo.