dannoura has asked for the wisdom of the Perl Monks concerning the following question:
hi,
I'm trying to work through my ISP provider's proxy, but for some reason every time I issue a request with it I get the ISP's homepage, which is obviously not the page I requested. I tried two scripts. The first is:
use LWP::Simple qw(&getstore $ua); $ua->proxy(http => 'http://www.tau.ac.il/tau.pac'); my $url='http://www.yahoo.com'; my $file='test.html'; print "success" if (getstore($url, $file));
The second is:
use LWP::UserAgent; open WFH, ">test.html" or die($!); my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/5.0"); $ua->env_proxy; $ua->proxy('http', 'http://www.tau.ac.il/tau.pac'); $ua->timeout(10); my $response = $ua->get('http://search.cpan.org/'); if ($response->is_success) { print WFH $response->content; } else { die $response->status_line; }
Any ideas as to the reason?
-----------------------------------
Any comments about coding style are welcome.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: lwp proxy problem
by bronto (Priest) on Apr 27, 2004 at 15:52 UTC | |
by dannoura (Pilgrim) on Apr 27, 2004 at 16:15 UTC | |
Re: lwp proxy problem
by cyocum (Curate) on Apr 27, 2004 at 15:46 UTC | |
Re: lwp proxy problem
by matija (Priest) on Apr 27, 2004 at 15:56 UTC |