2013-01-31 35 views
3

我是一種新的Perl,甚至更新的機械化。到目前爲止,當我試圖通過http獲取一個網站時,這沒有問題。Perl機械化響應只是「<HTML></HTML>」與https

現在我需要使用https獲取網站。我已經通過PPM安裝了Crypt::SSLeay

當我使用$mech->get($url),雖然,這是唯一的迴應,我得到:

"<HTML></HTML>" 

我檢查的地位和成功,兩人都OK(200和1)。

這裏是我的代碼:

use strict; 
use warnings; 
use WWW::Mechanize; 
use Crypt::SSLeay; 
$ENV{HTTPS_PROXY} = 'http://username:[email protected]:port'; 
//I have the https_proxy env variable set globally too. 

my $url = 'https://google.com'; 
//Every https site has the same response, 
//so I don't think google would cause problems. 

my $mech = WWW::Mechanize->new(noproxy => 0); 
$mech->get($url) or die "Couldn't load page"; 

print "Content:\n".$mech->response()->content()."\n\n"; 

正如你可以看到我身後的代理。我試過設置

$mech->proxy($myproxy); 

但無濟於事。我甚至試圖將它讀取到一個文件中,但是當我檢查它時,我得到了相同的響應內容。

任何類型的建議,將不勝感激,因爲我只是一個初學者,仍然有很多要了解的一切。謝謝!

回答