display client ip address on web page

Discussion in 'Perl Misc' started by Joe, Jul 22, 2003.

  1. Joe

    Joe Guest

    I need help writing a script that will display a web client's ip
    address on my web page.

    I am running apache on linux. I have perl installed.
     
    Joe, Jul 22, 2003
    #1
    1. Advertising

  2. Joe

    Dan Wilga Guest

    In article <>,
    (Joe) wrote:

    > I need help writing a script that will display a web client's ip
    > address on my web page.
    >
    > I am running apache on linux. I have perl installed.


    It doesn't even have to be a Perl script, if you have your HTML pages
    set up as server parsed (for server side includes). Just include this
    code:

    <!--#echo var="REMOTE_ADDR"-->

    See: http://httpd.apache.org/docs/howto/ssi.html for more info.

    (Sorry for the off-topic answer, but in this case it's justified, IMHO,
    since the easiest answer is not to use Perl.)

    --
    Dan Wilga
    ** Remove the -MUNGE in my address to reply **
     
    Dan Wilga, Jul 22, 2003
    #2
    1. Advertising

  3. Joe

    Steve in NY Guest

    On 22 Jul 2003 12:30:04 -0700, (Joe) wrote:

    >I need help writing a script that will display a web client's ip
    >address on my web page.
    >
    >I am running apache on linux. I have perl installed.


    #!/usr/local/bin/perl
    print "Content-type: text/plain","\n\n";

    $remote_host = $ENV{'REMOTE_HOST'};
    print "You are visiting from ", $remote_host, ". ";

    I just copied and pasted the above from here:

    http://www.oreilly.com/openbook/cgi/ch01_06.html

    you can add any tags, like this:

    print "<html><body>Hi there</body></html>";
     
    Steve in NY, Jul 23, 2003
    #3
  4. Joe

    Steve in NY Guest

    That will teach me to post before thinking...thanks Todd ;-)

    On Tue, 22 Jul 2003 20:14:49 GMT, "Todd de Gruyl" <> wrote:

    >On Tue, 22 Jul 2003 16:03:41 -0700, Steve in NY wrote:
    >
    >> print "Content-type: text/plain","\n\n";

    >...
    >> print "<html><body>Hi there</body></html>";

    >
    >of course, if you want that to display as html, change the content-type to
    >text/html, instead of text/plain
     
    Steve in NY, Jul 23, 2003
    #4
  5. Joe

    Tintin Guest

    "Joe" <> wrote in message
    news:...
    > I need help writing a script that will display a web client's ip
    > address on my web page.
    >
    > I am running apache on linux. I have perl installed.


    It isn't possible to determine the IP address the users to your website.
    The best you can do is determine the address of where the request has come
    from (or at least, claims to have come from).
     
    Tintin, Jul 23, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. avnrao
    Replies:
    1
    Views:
    7,334
    avnrao
    May 4, 2004
  2. =?Utf-8?B?QW5nZWw=?=

    Pass a Web Address and return a File System Address

    =?Utf-8?B?QW5nZWw=?=, Sep 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    556
    =?Utf-8?B?U3RldmUgQy4gT3Jy?=
    Sep 21, 2005
  3. mxia
    Replies:
    0
    Views:
    1,011
  4. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    How to: display page, post back, display again

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 14, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,052
    Walter Wang [MSFT]
    Jul 14, 2006
  5. Maziar Aflatoun

    How do I grab the client IP address in my Web service

    Maziar Aflatoun, Aug 9, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    124
Loading...

Share This Page