Connecting Tech Pros Worldwide Forums | Help | Site Map

How to lookup an IP address...

r0g
Guest
 
Posts: n/a
#1: Nov 15 '08
Not the visitors IP address, or rdns, indeed they seem to be getting in
the way of my googling for the answer despite qualifying my searches
with -reverse and -remote_addr

No, what I need is a good old fashioned DNS lookup.

e.g. $ip = dns('www.poo.com');

I know I could just pop a datagram off to port 53 and parse the result
but I feel sure php must provide a built-in for this fairly fundamental
task and that I'm just being lame at finding it.

Thanks,

Roger.

Jerry Stuckle
Guest
 
Posts: n/a
#2: Nov 15 '08

re: How to lookup an IP address...


r0g wrote:
Quote:
Not the visitors IP address, or rdns, indeed they seem to be getting in
the way of my googling for the answer despite qualifying my searches
with -reverse and -remote_addr
>
No, what I need is a good old fashioned DNS lookup.
>
e.g. $ip = dns('www.poo.com');
>
I know I could just pop a datagram off to port 53 and parse the result
but I feel sure php must provide a built-in for this fairly fundamental
task and that I'm just being lame at finding it.
>
Thanks,
>
Roger.
Maybe dns_get_record()?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
r0g
Guest
 
Posts: n/a
#3: Nov 15 '08

re: How to lookup an IP address...


Jerry Stuckle wrote:
Quote:
r0g wrote:
Quote:
>Not the visitors IP address, or rdns, indeed they seem to be getting in
>the way of my googling for the answer despite qualifying my searches
>with -reverse and -remote_addr
>>
>No, what I need is a good old fashioned DNS lookup.
>>
>e.g. $ip = dns('www.poo.com');
>>
>I know I could just pop a datagram off to port 53 and parse the result
>but I feel sure php must provide a built-in for this fairly fundamental
>task and that I'm just being lame at finding it.
>>
>Thanks,
>>
>Roger.
>
Maybe dns_get_record()?
>
Thanks Jerry,

It turns out dns_get_record is kind of overkill for what I need though.
It returns the domains entire DNS record and it doesn't work on Windows,
Mac , BSD or PHP4 however - it did lead me to stumble upon the function
gethostbyname() which does exactly what I am after :0) so thanks v.much!

Surprise surprise it turns out that's what they call it in C too! Doh!

Roger.
Closed Thread