Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Request POST with LWP

by iza (Monk)
on Nov 04, 2010 at 10:27 UTC ( [id://869429]=note: print w/replies, xml ) Need Help??


in reply to Request POST with LWP

i had the exaxt same problem and the solution was to initialize the proxy before sending the request

perldoc lwpcook gives some hints on this :

PROXIES Some sites use proxies to go through fire wall machines, or just a +s cache in order to improve performance. Proxies can also be used for + accessing resources through protocols not supported directly (or sup +ported badly :-) by the libwww-perl library. You should initialize your proxy setting before you start sending +requests: use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->env_proxy; # initialize from environment variables # or $ua->proxy(ftp => 'http://proxy.myorg.com'); $ua->proxy(wais => 'http://proxy.myorg.com'); $ua->no_proxy(qw(no se fi)); my $req = HTTP::Request->new(GET => 'wais://xxx.com/'); print $ua->request($req)->as_string; The LWP::Simple interface will call env_proxy() for you automatica +lly. Applications that use the $ua->env_proxy() method will normally no +t use the $ua->proxy() and $ua->no_proxy() methods. Some proxies also require that you send it a username/password in +order to let requests through. You should be able to add the required + header, with something like this: use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->proxy(['http', 'ftp'] => 'http://username:password@proxy.myo +rg.com'); $req = HTTP::Request->new('GET',"http://www.perl.com"); $res = $ua->request($req); print $res->decoded_content if $res->is_success;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-16 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found