当使用php对https soap服务器执行soap请求时:s SoapClient失败并带有SoapFault:
faultstring: Could not connect to host faultcode: HTTP
我必须确保soap服务器ssl证书有效,所以我正在使用
<?php
$soap=new SoapClient("mwsdl.wsdl"
,array(
"location"=>"https:examplesoapserver.com"
,"trace"=>1
,"stream_context"=>stream_context_create(array(
"ssl"=>array(
"verify_peer"=>true
,"allow_self_signed"=>false
)
)
)
)
);
Run Code Online (Sandbox Code Playgroud)
但这给了我SoapFault.
我测试了不同的设置:
OK location: has self-signed certificate verify_peer=>true allow_self_signed=>true
OK (without setting verify_peer) location: has self-signed certificate allow_self_signed=>false
NOT OK location: has self-signed certificate verify_peer=>true allow_self_signed=>false
OK (without setting verify_peer) location: ca-signed certificate allow_self_signed=>false
NOT OK location: ca-signed certificate verify_peer=>true allow_self_signed=>false
我有:
php version: 5.3.3 …