我尝试将SoapClient与cafile,local_cert和local_pk一起使用
function __construct($wsdl,$pem,$key,$cert){
$context = stream_context_create(
array(
"ssl" => array(
'verify_peer' => false,
'verifyhost ' => false,
"cafile" => $cert,
'local_cert' => $pem,
'local_pk' => $key
)
)
);
$this->client = new SoapClient($wsdl, array('soap_version' => SOAP_1_2,
'local_cert' => $pem,
'trace' => true,
'context' => $context
));
}
但我遇到此错误:无法连接到主机
我的wsdl是一种文档样式,他使用文字。
当我丢弃肥皂对象时:
object(SoapClient)[19]
public 'trace' => int 1
``public _stream_context' => resource(38, stream-context)
public '_soap_version' => int 2
public 'sdl' => resource(39, SOAP SDL)
答案 0 :(得分:0)
$context = stream_context_create(
array(
"ssl" => array(
'verify_peer' => true,
'allow_self_signed' => true,
"cafile" => $cert,
'local_cert' => $pem,
'local_pk' => $key
)
)
它的工作C: