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;
In reply to Re: Request POST with LWP
by iza
in thread Request POST with LWP
by suhijo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |