develooper Front page | perl.libwww | Postings from April 2003

LWP request receives 500 error, often

Aurelien Botman
April 30, 2003 07:42
LWP request receives 500 error, often
Message ID:
Hello all;

I've searched a bit through the list but can't find anything to answer my 
query: When I run the following code on certain sites, for example or, I get a response code of 500 
(error). Any idea why?

Aurelien Botman.

#!/user/bin/perl -w

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
require LWP::RobotUA;
use LWP::Simple;

$ua = new LWP::RobotUA 'Mozilla 4.7', '';
my $req = new HTTP::Request GET => '';

my $res = $ua->request($req);

print $res->code; # and '500' is printed, more often than not

if($res->is_success) {
        print $res->content;
} else {
        print $res->error_as_html;

__END__ Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About