我想访问无法验证证书的网站。我正在使用WWW :: Mechanize get请求。那么如何忽略这一点并继续连接到网站?
答案 0 :(得分:24)
use IO::Socket::SSL qw();
use WWW::Mechanize qw();
my $mech = WWW::Mechanize->new(ssl_opts => {
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
verify_hostname => 0, # this key is likely going to be removed in future LWP >6.04
});
如果IO :: Socket :: SSL早于1.79,请参阅PERL_LWP_SSL_VERIFY_HOSTNAME
。
答案 1 :(得分:4)
my $mech = WWW::Mechanize->new( 'ssl_opts' => { 'verify_hostname' => 0 } );