Creating a PHP SOAP request with a certificate

前端 未结 2 1164
南方客
南方客 2020-12-08 17:10

I am attempting to create a PHP SOAP connection to a .NET Web Service that has a self-signed certificate in order to lock down the service for communication over HTTPS. I co

2条回答
  •  误落风尘
    2020-12-08 17:53

    A side note: there is a way to make successful SOAP request and keep the private key and certificate file separated. To do this, you have to create a stream context and pass that as the context option:

       array(
         "local_cert" => "C:\\Certs\client_cert.pem",
         "local_pk"   => "/path/to/private/key"
          )
        )
      );
    
       $client = new \SoapClient($wsdl, array("context" => $context));
    

提交回复
热议问题