Connecting Tech Pros Worldwide Help | Site Map

How to lookup an IP address...

  #1  
Old November 15th, 2008, 03:05 PM
r0g
Guest
 
Posts: n/a
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.
  #2  
Old November 15th, 2008, 03:15 PM
Jerry Stuckle
Guest
 
Posts: n/a

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
==================
  #3  
Old November 15th, 2008, 03:55 PM
r0g
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get the ip address & country of the webpage visitor bushi answers 9 April 4th, 2007 02:05 PM
IP Address lookup problem Code Monkey answers 2 November 17th, 2005 09:50 AM
Function to retrieve domain name for an IP address? ITM answers 3 November 12th, 2005 03:39 PM
How to get a specific machine's IP address with it's name? Aries answers 1 July 19th, 2005 11:19 AM