开发者

How to ignore 'Certificate Verify Failed' error in perl?

开发者 https://www.devze.com 2023-03-22 13:27 出处:网络
I want to access a website where the certificate cannot be verified. I\'m using WWW::Mechanize get request. So how would go ab开发者_开发知识库out ignoring this and continues to connect to the website

I want to access a website where the certificate cannot be verified. I'm using WWW::Mechanize get request. So how would go ab开发者_开发知识库out ignoring this and continues to connect to the website?


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
});

With IO::Socket::SSL earlier than 1.79, see PERL_LWP_SSL_VERIFY_HOSTNAME.


my $mech = WWW::Mechanize->new( 'ssl_opts' => { 'verify_hostname' => 0 } );
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号