log the http response codes in the file
- by dexter
i have created HTTP::Request which looks like this:
#!/usr/bin/perl
require HTTP::Request;
require LWP::UserAgent;
require HTTP::Cookies;
$request = HTTP::Request->new(GET => 'http://www.google.com/');
$ua = LWP::UserAgent->new;
$cookie_jar = HTTP::Cookies->new();
$ua->cookie_jar($cookie_jar);
$cookie_jar->set_cookie(0,'testCookie','cookieValue','/','http://www.google.com/',80,0,0,86400,0);
$response = $ua->request($request);
if($response->is_success){
print "sucess\n";
print $response->code;
print "\n";
}
else {
print "fail\n";
die $response->code;
print "\n";
}
now, When i send Request:
i want to log the http response codes in the file
please help
thank you