...

View Full Version : HTTP Header Response



Phil Jackson
01-24-2010, 09: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?

Phil Jackson
01-24-2010, 09:17 AM
Ah, never mind, cracked it with


$ua->max_redirect(0);

just need to find the location...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum