Reolve an IP to domain name

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

    Reolve an IP to domain name

    Is there a URL which can be included on a custom 404 error page, which
    will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
    the domain of the given IP address?

    Or is there an easier way to automatically resolve an I.P.?
  • Tim

    #2
    Re: Reolve an IP to domain name

    On 19 Jul 2004 16:16:45 -0700,
    vardogerrubbish @hotmail.com (A B) posted:
    [color=blue]
    > Is there a URL which can be included on a custom 404 error page, which
    > will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
    > the domain of the given IP address?
    >
    > Or is there an easier way to automatically resolve an I.P.?[/color]

    See how your web server handles "hostnamelookup s", or write some code to
    look up an address and pass it back to the server. But what good's showing
    a visitor their IP or address in a 404 message? It won't mean anything to
    them.

    Exactly how you achieve this is beyond the scope of this news group.
    You'll get better answers somewhere else. Try a server news group.

    --
    If you insist on e-mailing me, use the reply-to address (it's real but
    temporary). But please reply to the group, like you're supposed to.

    This message was sent without a virus, please delete some files yourself.

    Comment

    • Mark Tranchant

      #3
      Re: Reolve an IP to domain name

      A B wrote:[color=blue]
      > Is there a URL which can be included on a custom 404 error page, which
      > will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
      > the domain of the given IP address?[/color]

      Which domain?

      My IP, 81.174.183.177 is:

      tranchant.plus. com
      billericaybapti st.net
      billericaychora l.org.uk
      step-by-step.org.uk

      You could use the PTR DNS record, which points to the first one. You
      could easily write a PHP page that would do this, I'm guessing.

      Get the Internet host name corresponding to a given IP address


      --
      Mark.

      Comment

      • A B

        #4
        Re: Reolve an IP to domain name

        Excellent. Thanks for the input. I'll get cracking on a solution to
        my dilemma. It isn't exclusively for a 404 page, but this was where I
        first saw the server side include. Didn't realise I could use it
        anywhere.

        Cheers.

        Mark Tranchant <mark@tranchant .plus.com> wrote in message news:<oI3Lc.467 2$Fc7.866070@st ones.force9.net >...[color=blue]
        > A B wrote:[color=green]
        > > Is there a URL which can be included on a custom 404 error page, which
        > > will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
        > > the domain of the given IP address?[/color]
        >
        > Which domain?
        >
        > My IP, 81.174.183.177 is:
        >
        > tranchant.plus. com
        > billericaybapti st.net
        > billericaychora l.org.uk
        > step-by-step.org.uk
        >
        > You could use the PTR DNS record, which points to the first one. You
        > could easily write a PHP page that would do this, I'm guessing.
        >
        > http://www.php.net/manual/en/function.gethostbyaddr.php[/color]

        Comment

        • Philip Ronan

          #5
          Re: Reolve an IP to domain name

          On 20/7/04 12:16 am, A B wrote:
          [color=blue]
          > Is there a URL which can be included on a custom 404 error page, which
          > will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
          > the domain of the given IP address?
          >
          > Or is there an easier way to automatically resolve an I.P.?[/color]

          Are you using PHP? This might work:

          <?php
          $hostname = gethostbyaddr($ _SERVER['REMOTE_ADDR']);
          echo $hostname;
          ?>

          Phil

          --
          Philip Ronan
          phil.ronanzzz@v irgin.net
          (Please remove the "z"s if replying by email)


          Comment

          • Philip Ronan

            #6
            Re: Reolve an IP to domain name

            On 21/7/04 10:07 am, Philip Ronan wrote:
            [color=blue]
            > On 20/7/04 12:16 am, A B wrote:
            >[color=green]
            >> Is there a URL which can be included on a custom 404 error page, which
            >> will accept the parameter (<!--#echo var="REMOTE_ADD R" -->) and return
            >> the domain of the given IP address?
            >>
            >> Or is there an easier way to automatically resolve an I.P.?[/color]
            >
            > Are you using PHP? This might work:
            >
            > <?php
            > $hostname = gethostbyaddr($ _SERVER['REMOTE_ADDR']);
            > echo $hostname;
            > ?>
            >
            > Phil[/color]

            I thought I'd try it out: http://www.japanesetranslator.co.uk/a.php

            Works OK for me.

            --
            Philip Ronan
            phil.ronanzzz@v irgin.net
            (Please remove the "z"s if replying by email)


            Comment

            Working...