ezekiel has asked for the wisdom of the Perl Monks concerning the following question:
Hello all
For some time I have made use of Net::FTP in automating the download of files from FTP repositories. Recently, however, I have started to need to download a file from a HTTP source. After looking around, it seemed LWP::UserAgent was an appropriate tool and so:
my $URL = "http://target.site.com/path/to/file.gz"; my $ua = LWP::UserAgent->new(); my $response = $ua->get("$URL"); if ($response->is_success) { print $response->content; } else { die $response->status_line; }
Now, when I run it I get at server error 500. Yet if I browse to the URL with Firefox I have no problem accessing the file??
What am I doing wrong? and is LWP::UserAgent the best tool for this type of job?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with LWP::UserAgent server error 500
by tlm (Prior) on Jun 29, 2005 at 05:44 UTC | |
by ezekiel (Friar) on Jun 30, 2005 at 23:54 UTC | |
|
Re: Help with LWP::UserAgent server error 500
by CountZero (Bishop) on Jun 29, 2005 at 05:50 UTC | |
|
Re: Help with LWP::UserAgent server error 500
by PodMaster (Abbot) on Jun 29, 2005 at 05:28 UTC | |
by inman (Curate) on Jun 29, 2005 at 16:44 UTC | |
|
Re: Help with LWP::UserAgent server error 500
by Anonymous Monk on Jun 29, 2005 at 15:07 UTC |