anchylo has asked for the wisdom of the Perl Monks concerning the following question:
Hello I am having difficulty downloading a file (and am tired of downloading them directly...
<code> #!/usr/bin/perl
use LWP;
my $url = 'https://192.168.1.1/cgi-bin/get-sae-log.cgi?host=thingy&date=20090703'; # Yes, HTTPS! my $browser = LWP::UserAgent->new;
my $response = $browser->get($url);
die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "Whee, it worked! I got that ", $response->content_type, " document!\n"; <\code>
results with:
C:\dhcp.logs\bc>xplore_lwp.pl
Whee, it worked! I got that application/x-bzip2 document!
ok, so i can see the document, but am at a loss as to how to name and download the file.
I have tried lwp-download, but got massive errors... any help appreciated.
<code> #!/usr/bin/perl
use LWP;
my $url = 'https://192.168.1.1/cgi-bin/get-sae-log.cgi?host=thingy&date=20090703'; # Yes, HTTPS! my $browser = LWP::UserAgent->new;
my $response = $browser->get($url);
die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "Whee, it worked! I got that ", $response->content_type, " document!\n"; <\code>
results with:
C:\dhcp.logs\bc>xplore_lwp.pl
Whee, it worked! I got that application/x-bzip2 document!
ok, so i can see the document, but am at a loss as to how to name and download the file.
I have tried lwp-download, but got massive errors... any help appreciated.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: LWP HTTPS and a sore head
by Anonymous Monk on Jul 15, 2009 at 20:31 UTC | |
by perlsaran (Sexton) on Jul 16, 2009 at 03:50 UTC | |
Re: LWP HTTPS and a sore head
by tokpela (Chaplain) on Jul 16, 2009 at 08:37 UTC | |
Re: LWP HTTPS and a sore head
by hnd (Scribe) on Jul 16, 2009 at 04:48 UTC | |
Re: LWP HTTPS and a sore head
by hnd (Scribe) on Jul 16, 2009 at 04:48 UTC | |
Re: LWP HTTPS and a sore head
by BaldManTom (Friar) on Jul 16, 2009 at 13:04 UTC | |
by monarch (Priest) on Jul 16, 2009 at 14:33 UTC |
Back to
Seekers of Perl Wisdom