in reply to Re: HTTP client in perl
in thread HTTP client in perl

Sorry had a bit of a problem with the old html . . .

From the lwpcook doc http://www.linpro.no/lwp/libwww-perl/lwpcook.pod comes this generic http client - in my time of need this did it for me:

#!/usr/local/bin/perl -w
use LWP::UserAgent;
$myurl = "http://www.perlmonks.org";
$ua = new LWP::UserAgent; $ua->agent("$0/0.1 " . $ua->agent);
$ua->agent("Mozilla/8.0");
# pretend we are very capable browser
$req = new HTTP::Request 'GET' => "$myurl";
$req->header('Accept' => 'text/html');
#send request
$res = $ua->request($req);
#check the outcome
if ($res->is_success) {
print $res->content;
#All this means is you got some html back . . .
}
else {
print "Error: " . $res->status_line . "\n";
}