in reply to download ZIP file from web
use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; #my $req = HTTP::Request->new(GET => 'http://search.cpan.org/CPAN/auth +ors/id/G/GA/GAAS/libwww-perl-5.836.tar.gz'); my $req = HTTP::Request->new(GET => 'http://usename:password@host/path +/to/file.zip'); my $res = $ua->request($req); if ($res->is_success) { # here put what you want to do with the file # print $res->content; # or # open( my $file, '> file.zip'); # print $file $res->content; # close($file); } else { print STDERR $res->status_line; }
|
|---|