#!/usr/local/bin/perluse LWP::UserAgent;
use HTTP::Request;my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeout => 30);
my $url = "http://example.com/";
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){# parse your response here
}elsif ($response->is_error){
print $response->error_as_HTML;
}
#!/usr/local/bin/perluse LWP::UserAgent;
use HTTP::Request;my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeout => 30);
my $url = "http://example.com/";
my $request = HTTP::Request->new('GET', $url);
my $response = $agent->request($request);# Check the outcome of the response
if ($response->is_success){# parse $response->content here
}elsif ($response->is_error){
print $response->error_as_HTML;
}