Phil Jackson
01-24-2010, 08:14 AM
Morning all, I was using the following code to find the response code to a domain;
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://www.actwebdesigns.co.uk/');
if ($response->is_success) {
print $response->status_line;
}
else {
die $response->status_line;
}
yet it seems to return "200 OK" which yes, after the redirect that is correct.
But for 'http://www.actwebdesigns.co.uk/' is actually 301, could someone point me in the right direction for how I can return the correct response code?
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://www.actwebdesigns.co.uk/');
if ($response->is_success) {
print $response->status_line;
}
else {
die $response->status_line;
}
yet it seems to return "200 OK" which yes, after the redirect that is correct.
But for 'http://www.actwebdesigns.co.uk/' is actually 301, could someone point me in the right direction for how I can return the correct response code?