How to lookup an IP address...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • r0g

    #1

    How to lookup an IP address...

    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.co m');

    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

    #2
    Re: How to lookup an IP address...

    r0g wrote:
    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.co m');
    >
    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@attgl obal.net
    =============== ===

    Comment

    • r0g

      #3
      Re: How to lookup an IP address...

      Jerry Stuckle wrote:
      r0g wrote:
      >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.co m');
      >>
      >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.

      Comment

      Working...