/index.html
####
http://www.somehost.com/index.html
####
use LWP::UserAgent;
use HTTP::Request::Common;
if ($#ARGV != 1) {
print STDERR "Usage: $0 \"URL to fetch\" \"save location\"\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) {
open(OUTPUT,">".$ARGV[1]) || die "Can't open outfile: $!";
print OUTPUT $res->content;
close(OUTPUT);
}
else {
print $res->status_line,"\n";
}
####
program.pl http://www.somehost.com/index.html /tmp/somehost_index.html