Connecting Tech Pros Worldwide Help | Site Map

Reolve an IP to domain name

A B
Guest
 
Posts: n/a
#1: Jul 20 '05
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.?
Tim
Guest
 
Posts: n/a
#2: Jul 20 '05

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.
Mark Tranchant
Guest
 
Posts: n/a
#3: Jul 20 '05

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.
A B
Guest
 
Posts: n/a
#4: Jul 20 '05

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]
Philip Ronan
Guest
 
Posts: n/a
#5: Jul 20 '05

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)


Philip Ronan
Guest
 
Posts: n/a
#6: Jul 20 '05

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)


Closed Thread