gpt4 book ai didi

php - Soapclient https 请求

转载 作者:太空宇宙 更新时间:2023-11-03 14:52:24 25 4
gpt4 key购买 nike

场景:通过 SSL 从我的本地主机到外部服务器的 SOAP 请求。

PHP 版本:5.6.3

第一次尝试:

$options    = array (
'encoding' => 'UTF-8',
'stream_context' => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
)
)
),
);
$client = new SoapClient('https://www.???.es/index.php/api/soap?wsdl', $options);

错误:SOAP-ERROR:正在解析 WSDL

已找到建议的解决方案 here by tobik(使用之前下载的 WDSL 文件请求)

第二次尝试:

$filename = 'test.wsdl';
$uri = dirname(__FILE__) . DIRECTORY_SEPARATOR .$filename;
$options = array (
'encoding' => 'UTF-8',
'location' => 'https://www.???.es',
'uri' => $uri,
'stream_context' => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
)
)
),
);
$client = new SoapClient(null, $options);

错误:未捕获的 SoapFault 异常:[Client] 看起来我们在...中没有 XML 文档

最佳答案

终于解决了添加

openssl.cafile=/etc/ssl/certs/ca-bundle.crt

到 php.ini

关于php - Soapclient https 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32992076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com