我正在尝试使用perl脚本从运行第三方软件的本地计算机中检索信息。我可以使用Web浏览器查看它,但我需要自动化它。问题是它似乎不喜欢软件在安装时创建的SSL证书。
没问题说我。我只是告诉LWP:UserAgent忽略证书。嗯......同样的错误。
这是我正在使用的测试脚本......
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname' => 0 } );
my $response = $ua->get( 'https://192.168.1.50' );
print "\n\n";
if ( defined( $response ) ) {
print $response->as_string;
}
else {
print "No response object created.";
}
print "\n";
......这是我得到的回应......
500 Can't connect to 192.168.1.50:443 (certificate verify failed)
Content-Type: text/plain
Client-Date: Tue, 05 Nov 2013 16:42:53 GMT
Client-Warning: Internal response
Can't connect to 192.168.1.50:443 (certificate verify failed)
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/local/share/perl5/LWP/Protocol/http.pm line 51.
从我在文档中看到的内容以及我在各种论坛上看到的建议是,将'verify_hostname'设置为false值会导致它忽略无效的证书。
有关我缺少的任何建议吗?