我是Perl的新手,但需要在我正在開發的項目中使用它。我需要做的是檢查一個URL是否有301重定向,如果有,獲取位置。下面告訴我的代碼,但不是位置:如何在Perl中獲取HTTP狀態和位置標題?
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->max_redirect(0);
my $response = $ua->get('http://www.actwebdesigns.co.uk/');
if ($response->is_success) {
print $response->status_line;
print $response->progress;
}
else {
die $response->status_line;
}
沒有人知道如何獲得位置?
問候,
菲爾
謝謝!那很完美 – 2010-01-24 09:04:44