Connecting Tech Pros Worldwide Help | Site Map

Reolve an IP to domain name

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 07:23 PM
A B
Guest
 
Posts: n/a
Default 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_ADDR" -->) and return
the domain of the given IP address?

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

  #2  
Old July 20th, 2005, 07:23 PM
Tim
Guest
 
Posts: n/a
Default 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_ADDR" -->) 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 "hostnamelookups", 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.
  #3  
Old July 20th, 2005, 07:23 PM
Mark Tranchant
Guest
 
Posts: n/a
Default 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_ADDR" -->) and return
> the domain of the given IP address?[/color]

Which domain?

My IP, 81.174.183.177 is:

tranchant.plus.com
billericaybaptist.net
billericaychoral.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

--
Mark.
  #4  
Old July 20th, 2005, 07:24 PM
A B
Guest
 
Posts: n/a
Default 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.4672$Fc7.866070@stones.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_ADDR" -->) and return
> > the domain of the given IP address?[/color]
>
> Which domain?
>
> My IP, 81.174.183.177 is:
>
> tranchant.plus.com
> billericaybaptist.net
> billericaychoral.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]
  #5  
Old July 20th, 2005, 07:24 PM
Philip Ronan
Guest
 
Posts: n/a
Default 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_ADDR" -->) 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@virgin.net
(Please remove the "z"s if replying by email)


  #6  
Old July 20th, 2005, 07:24 PM
Philip Ronan
Guest
 
Posts: n/a
Default 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_ADDR" -->) 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@virgin.net
(Please remove the "z"s if replying by email)


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.