问题描述
我需要使用PHP的SoapClient和myfile-ca.crt。
我如何告诉SoapClient构造函数使用客户端证书(crt文件)?
I need to use PHP's SoapClient with myfile-ca.crt.How can I tell SoapClient constructor to work with client certificate (crt file) ?
我经验丰富的php SoapClient,但我从来不需要使用安全soap客户端。
I am experienced with php SoapClient, but I never needed to work with secure soap client.
感谢任何帮助
推荐答案
SoapClient,你可以传入一个配置数组作为第二个参数。此数组允许选项 local_cert
。 local_cert选项应该指向证书文件(在我的经验中,需要绝对路径才能使其工作。)
When constructing your SoapClient, you can pass in a configuration array as the second parameter. This array allows the options local_cert
. The local_cert option should point to the certificate file (in my experience the absolute path was needed to get it to work).
$wsdl = "service.wsdl";
$cert = "c:\secure_cert\webservice.pem";
$client = new SoapClient($wsdl, array('local_cert' => $cert);
$ b b
另请参阅上的示例
注意:我一直给予.pem文件;不知道.crt是否相同/工作原理相同...?
Note: I've always been given .pem files; not sure if .crt is the same / works the same...?
这篇关于如何使用PHP5 SoapClient :: SoapClient()与客户端证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!