新证书是" Symantec Class 3 EV SSL CA - G3"。客户有CentOS。无法控制服务器,它是第三方。当在Firefox和Chrome中加载WDSL https地址时,两个浏览器都会显示"安全连接",没问题。
WSDL地址为https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL
测试代码:
$success = false;
$attempts = 0;
while (($success === false) && ($attempts < 10)) {
$attempts ++;
echo 'Attempt ' . $attempts . '<br>';
try {
$wsdl = 'https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL';
$entity_loader_status_old = libxml_disable_entity_loader(false);
$SoapClient = new SoapClient($wsdl);
$seed = $SoapClient -> getSeed();
libxml_disable_entity_loader($entity_loader_status_old);
$success = true;
} catch (Exception $Exception) {
echo $Exception -> getMessage() . '<br>';
}
}
if ($success === true) {
echo 'SUCCESS';
} else {
echo 'ERROR';
}
默认情况下连接是安全的,因为PHP版本是5.6.22(大于5.5.x)。
答案 0 :(得分:0)
可能重复:OpenSSL: unable to verify the first certificate for Experian URL
要解决创建cafile.pem
并连接所需的Symantec证书(主要中间人和根证书),如上面可能的重复问题链接所示(请参阅 spuder 的答案)。
要创建的引自 spuder 的cafile.pem
:
-----BEGIN CERTIFICATE----- (Your Primary SSL certificate: your_domain_name.crt) -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- (Your Intermediate certificate: DigiCertCA.crt) -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- (Your Root certificate: TrustedRoot.crt) -----END CERTIFICATE-----
然后在PHP中使用下一个$options
创建SoapClient
对象:
$options = [
'stream_context' => stream_context_create([
'ssl' => [
'cafile' => __DIR__ . '/cafile.pem',
],
]),
];
$SoapClient = new SoapClient($wsdl, $options);