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

LWP request receives 500 error, often

From:
Aurelien Botman
Date:
April 30, 2003 07:42
Subject:
LWP request receives 500 error, often
Message ID:
E19Apm1-0005MP-00@brown.csi.cam.ac.uk
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 
www.feedmechocolate.com or www.google.com, I get a response code of 500 
(error). Any idea why?

Thanks
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', 'ab384@cam.ac.uk';
$ua->delay(0);
$ua->use_sleep(0);
my $req = new HTTP::Request GET => 'http://www.feedmechocolate.com';

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__




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About