By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,492 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,492 IT Pros & Developers. It's quick & easy.

Reolve an IP to domain name

P: n/a
A B
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.?
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Tim
On 19 Jul 2004 16:16:45 -0700,
va*************@hotmail.com (A B) posted:
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.?


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.
Jul 20 '05 #2

P: n/a
A B wrote:
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?


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.
Jul 20 '05 #3

P: n/a
A B
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 <ma**@tranchant.plus.com> wrote in message news:<oI*******************@stones.force9.net>...
A B wrote:
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?


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

Jul 20 '05 #4

P: n/a
On 20/7/04 12:16 am, A B wrote:
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.?


Are you using PHP? This might work:

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

Phil

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 20 '05 #5

P: n/a
On 21/7/04 10:07 am, Philip Ronan wrote:
On 20/7/04 12:16 am, A B wrote:
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.?


Are you using PHP? This might work:

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

Phil


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

Works OK for me.

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.