in reply to HTTP client in perl
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";
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: HTTP client in perl
by lostcause (Monk) on Apr 26, 2000 at 23:14 UTC |