我一直在阅读我能找到的所有问题/答案,但没有一个能解决我的问题..
这里是使用 cURL 和证书连接到相同的 url($pem = .pem 文件的绝对路径) 这行得通
$ch = curl_init($wsdl);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSLCERT, $pem);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$response = curl_exec($ch);
这里是我尝试通过 SOAP 连接到 wsdl 的代码
$client = new SoapClient($wsdl, array('local_cert' => $pem));
甚至尝试在“local_cert”中加载证书的内容
$client = new SoapClient($wsdl, array('local_cert' => file_get_contents($pem)));
在这两行 soap 代码中,我从服务器收到一个错误,说我没有被授权...
我需要在发送证书之前启用某些功能吗?
最佳答案
您可能需要传递一些用户名和密码,试试这个:
curl –k –u user:password –d @myRequestFile.xml uri
关于php - SoapClient 不发送证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11187646/