我的 Paypal 代码未使用选项 verify_peer_name => true 运行。当我使用选项 false 尝试相同的 Soap Request 时它起作用了,对我来说似乎是一个 PHP7 错误?这对我适用于 PHP5.3。 我总是得到错误:
无法连接到主机
我已经在我的服务器上安装了证书,我也能够毫无问题地 curl url,只是 SoapClient 没有按预期工作。
有人知道参数verify_peer_name 的真正作用吗?
$client = new SoapClient("https://xxx.paypal/the.wsdl",
array(
"trace" => 1,
"location" => "https://xxx.paypal/the.wsdl",
'exceptions' => 1,
"stream_context" => stream_context_create(
array(
'ssl' => array(
'verify_peer' => true,
'verify_peer_name' => true,
)
)
)
)
);
最佳答案
我找到了 verify_peer_name 并得到了这个..检查它是否可以帮助你: peer_name 字符串
Peer name to be used. If this value is not set, then the name is guessed based on the hostname used when opening the stream.
verify_peer bool 值
Require verification of SSL certificate used.
Defaults to TRUE.
verify_peer_name bool 值
Require verification of peer name.
Defaults to TRUE.
关于PHP7 SoapClient verify_peer_name : SOAP Error: Could not connect to host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36628405/