* John Von Essen ([EMAIL PROTECTED]) [12 Feb 2003 17:42]:
> use LWP::UserAgent;
> my $ua = LWP::UserAgent->new(
> env_proxy => 1,
> keep_alive => 1,
> timeout => 30,
> agent => 'Mozilla/4.0 (compatible; MSIE 5.21; Mac_PowerPC)',
> );
> $request = HTTP::Request->new('HEAD',"http://www.apache.org");
> $r = $ua->request($request);
> $res = $r->headers->server;
> print "$res\n";
my $res = $ua->head('http://www.apache.org')->headers->server;
> ...OR to get just the HTML source:
> $request = HTTP::Request->new('GET',"http://www.apache.org");
> $r = $ua->request($request);
> $res = $r->content;
> print "$res\n";
my $res = $ua->get("http://www.apache.org")->content;
Normally you'd have error handling. I just wanted to note the
get(), head() and post() convenience functions.
cheers,
--
Iain.