Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: LWP and Remote IP

by Kanji (Parson)
on Nov 12, 2005 at 10:32 UTC ( #507957=note: print w/ replies, xml ) Need Help??


in reply to LWP and Remote IP

You don't need to hack LWP at all: the information is available to you via the header() method on the response object.

use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $res = $ua->get('http://www.booble.com/'); print $res->header('client-peer');

However, I don't see the availability of the client-peer header documented in the HTTP::Response or HTTP::Headers POD pages, so this may not work in previous or future LWP releases.

(Works for me with LWP::UserAgent 2.033, HTTP::Message 1.56 and HTTP::Headers 1.62.)

    --k.



Comment on Re: LWP and Remote IP
Download Code
Re^2: LWP and Remote IP
by davemcgi (Novice) on Nov 14, 2005 at 07:18 UTC
    Kanji, thank you, that undocumented property was exactly what I was looking for. Working great :-)

    Thank (INSERT-DEITY-OF-YOUR-CHOICE) for Perl Monks
Re^2: LWP and Remote IP
by ikegami (Pope) on Nov 15, 2005 at 18:20 UTC
    The LWP which comes with ActivePerl 5.6.1 doesn't set this pseudo-header.
    >perl -e "use LWP; print $LWP::VERSION 5.64

Log In?
Username:
Password:

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

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

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls