小编Mac*_*cke的帖子

Php SoapClient verify_peer => true失败并带有ca-signed证书

当使用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 …

php ssl soap-client soapfault

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

php ×1

soap-client ×1

soapfault ×1

ssl ×1