gpt4 book ai didi

PHP SoapClient,如何连接证书?

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

我创建新的 SoapClient

$this->soap = new \SoapClient($this->wdls // WDLS with corect host
, [
'exceptions' => 0,
'trace' => TRUE,
'local_cert' => $this->local_cert, // PEM file
'passphrase' => $this->passphrase, // password for PEM
'authentication' => SOAP_AUTHENTICATION_DIGEST,
'ssl_method' => SOAP_SSL_METHOD_SSLv2,
'cache_wsdl' => WSDL_CACHE_NONE,
]);
$this->soap->getInfo([...]);

但我得到一个错误:无法连接到主机

我使用 Firefox 测试了连接,并且能够连接。可能是什么问题?

最佳答案

开始 - 已关闭服务器上的端口。所以我无法到达远程服务器。毕竟 TLS 1.2 有问题,内置的 SOAP 客户端不接受配置,它帮助我手动指定协议(protocol)版本。

$this->soap = new \SoapClient($this->wdls, [
'exceptions' => 1,
'trace' => TRUE,
'local_cert' => $this->local_cert,
'passphrase' => $this->passphrase,
//'ssl_method' => SOAP_SSL_METHOD_SSLv2, // not work!
'authentication' => SOAP_AUTHENTICATION_DIGEST,
"soap_version" => SOAP_1_2,
'cache_wsdl' => WSDL_CACHE_NONE,
'stream_context' => stream_context_create([
'ssl' => [
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, // it's work!
]
]),
]);

关于PHP SoapClient,如何连接证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46895593/

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