这是我的代码:
my $lwpcurl = LWP::Curl->new(CURLOPT_SSL_VERIFYHOST => 0,CURLOPT_SSL_VERIFYPEER=>0);
my $content;
$content = $lwpcurl->get($url);
我收到此错误:
`SSL peer certificate was not ok`
答案 0 :(得分:1)
LWP::Curl不接受CURLOPT_SSL_VERIFYHOST
/ CURLOPT_SSL_VERIFYPEER
参数作为其构造函数!
use LWP::Protocol::Net::Curl ssl_verifyhost => 0, ssl_verifypeer => 0;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $content = $ua->get($url);
请注意,LWP :: Protocol :: Net :: Curl会改变默认的LWP :: UserAgent行为,因此您仍然使用$ua = LWP::UserAgent->new
,而内部使用libcurl
。