in reply to RE: RE: LWP::Simple get function...
in thread LWP::Simple get function...
This is a little script I wrote that does a simple get. I'm behind a firewall as well. LWP::Simple might have a proxy option, but I had this code handy. This way you won't have to look up the IP of every host you want to connect to.use LWP::UserAgent; use HTTP::Request::Common; if ($#ARGV != 0) { print STDERR "Usage: $0 \"URL to fetch\"\n"; exit; } my $agent = new LWP::UserAgent; $agent->proxy(['http','ftp'],'http://192.168.1.1:8080'); my $req = GET($ARGV[0]); my $res = $agent->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line,"\n"; }
/\/\averick
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: LWP::Simple get function...
by Win (Novice) on Dec 17, 2007 at 14:44 UTC | |
by maverick (Curate) on Dec 17, 2007 at 16:15 UTC | |
by olus (Curate) on Dec 17, 2007 at 14:59 UTC |