#! /s/std/bin/perl -wT

use lib '/s/perl/i386_cent5/lib/site_perl/5.8.8';
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTML::Template;
use LWP::UserAgent [search.cpan.org];
use HTTP::Request [kobesearch.cpan.org];

my $URL = 'http://cs.wisc.edu/~cs302/main.html';

my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeout => 30);
my $header = HTTP::Request->new(GET => $URL);
my $request = HTTP::Request->new('GET', $URL, $header);
my $response = $agent->request($request);

# Check the outcome of the response
if ($response->is_success){
print "URL:$URL\nHeaders:\n";
print $response->headers_as_string;
print "\nContent:\n";
print $response->as_string;
}elsif ($response->is_error){
print "Error:$URL\n";
print $response->error_as_HTML;
} 
