【发布时间】:2019-02-08 07:45:35
【问题描述】:
我正在尝试通过 Docker 应用程序中的 SOAP 连接到 SSL 主机。
尝试这样做时,我必须在传输级别禁用 SSL 以使其正常工作。我正在使用这样的代码:
$context = stream_context_create([
'ssl' => [
// set some SSL/TLS specific options
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]);
$client = new SoapClient(null, [
'location' => 'https://...',
'uri' => '...',
'stream_context' => $context
]);
这也是most upvoted answer on this question.
所以,我想要实现的是在没有这种 hack 的情况下让连接运行。
如果我忽略它,我会收到以下异常:
( ! ) Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.myhost.tld/gateway/Method?wsdl' : failed to load external entity "https://api.myhost.tld/gateway/Method?wsdl" in /var/www/html/app/code/local/Vendor/MyHost/Model/Method.php on line 31
【问题讨论】: