Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

how do I get a website visitor's host address

by keiusui (Monk)
on Jan 31, 2006 at 05:53 UTC ( #526667=perlquestion: print w/ replies, xml ) Need Help??
keiusui has asked for the wisdom of the Perl Monks concerning the following question:

I know that $ENV{REMOTE_ADDR} returns the IP address of a visitor. How do I get the hostname of a visitor?

For example, this website tells you your hostname:
whatismyipaddress.com/staticpages/index.php/whatismyhostname

Comment on how do I get a website visitor's host address
Download Code
Re: how do I get a website visitor's host address
by jbrugger (Parson) on Jan 31, 2006 at 06:04 UTC
    this isn't Perl related, is it?
    But anyway, try digging into the host name lookup :)
    dig xxx.xxx.xxx.xxx host xxx.xxx.xxx.xxx nslookup xxx.xxx.xxx.xxx
    and there are more possible ways.

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: how do I get a website visitor's host address
by McDarren (Abbot) on Jan 31, 2006 at 06:05 UTC
      ah, ok it can be (and probably is a Perl question :)

      You might look here: CGI Environment Variables as well.

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: how do I get a website visitor's host address
by idle (Pilgrim) on Jan 31, 2006 at 06:06 UTC
    $ENV{'REMOTE_HOST'}
Re: how do I get a website visitor's host address
by l.frankline (Hermit) on Jan 31, 2006 at 06:12 UTC

    Hi,

    $ENV{HTTP_HOST} = whatismyipaddress.com
    $ENV{PATH_INFO} = staticpages/index.php

    cheers

    Don't put off till tomorrow, what you can do today.

Re: how do I get a website visitor's host address
by strat (Canon) on Jan 31, 2006 at 09:34 UTC

    But don't put too much trust into this ip or hostname, because often it's a proxy's hostname or ip-address and not the enduser's one

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://526667]
Approved by bmann
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-07-14 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (258 votes), past polls