SoapClient over https verify server certificate
Posted: Thu Oct 06, 2011 10:39 am
Hi All,
I really need help.
I am now reprogramming a soapClient to another server. I want to call web services on that server.
I need this connection to be over https.
To connect to the server over https I have no problem.
The problem is to verify the server certificate.
I tried this:
but this work if the server certificate is fine and even if i connect to the server through other host name it still works. while it shouldn't( I didn't replace the certificate only the host name).
Please... help...
Ben
I really need help.
I am now reprogramming a soapClient to another server. I want to call web services on that server.
I need this connection to be over https.
To connect to the server over https I have no problem.
The problem is to verify the server certificate.
I tried this:
Code: Select all
$context = stream_context_create(
array(
'SSL' => array(
'allow_self_signed' => FALSE,
"verify_peer " => TRUE,
"cafile" => $fileName,
"capture_peer_cert" => TRUE
)
)
);
$client = new SoapClient("https://<someServer>/WebService.asmx?WSDL",
array("exceptions" => 1,"stream_context" => $context));
$result1 = $client->HelloWorld();
print_r($result1);
Please... help...
Ben