好的......让我们看看这是否更清楚。
我正在通过 LWP::UserAgent 将 XML 文档 POST 到远程第三方服务器。
他们之前通过 CPanel 和 Putty 命令行“定位”调用向我发送了我安装在服务器上的 .crt 文件,并验证了他们的地址以及它们存在的事实。证书在那里。
我确保我安装了 LWP::Protocol::https 和所有其他必要的 Perl 模块,包括 Mozilla::CA、Crypt::SSLeay 等。
当我运行脚本时,我收到以下错误:
发生错误
500 无法连接到 shortURL:端口(证书验证失败) 500 无法连接到 shortURL:端口(证书验证失败) 内容类型:文本/纯文本客户端日期:2012 年 1 月 25 日星期三 17:53:36 GMT客户端警告:内部响应无法连接到 shortURL:端口(证书验证失败) LWP::Protocol::https::Socket:SSL 连接尝试失败,出现未知错误错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 / usr/lib/perl5/site_perl/5.8.8/LWP/Protocol/http.pm 第 51 行。
这是调用代码:
sub ConsumerInfo {
my $cid = shift;
my $response = undef;
my $sendXML = &Create_ConsumerInfo_Request($cid);
if ($sendXML) {
&DoXMLUpload($sendXML);
my $browser = LWP::UserAgent->new(agent => 'site_perl',
ssl_opts => {
verify_hostname => 1,
SSL_ca_path => '/home/<mysite>/ssl/certs/',
},);
$browser->credentials('shortURL:port','realm','username'=>'password');
$response = $browser->request(POST 'longURL',
Content_Type => 'text/xml',
Content => $sendXML);
print "Content-type:text/html\n\n";
print $response->error_as_HTML unless $response->is_success;
print $response->as_string;
} else {
&ErrorMsg("No XML Code Was Found.");
exit;
}
# ===============================================================
# Need to insert parser in here to convert this into an array.
# ===============================================================
return $response;
}
有什么想法吗?我在这里没有想法了。:(