Using PHP Curl SSL

General discussion forum for the Zend Server

Using PHP Curl SSL

Postby jokimen on Thu Jan 24, 2013 1:20 pm

I am testing the ssl connection , but I am not able to connect to the server from url, https://servicos.portaldasfinancas.gov. ... ws/faturas. I have convert a PFX file to PEM file.
My Test code is following :


//////////////////// test connection script/////////////////////////////////

public function process($url)
{
$soap = curl_init();


curl_setopt($soap, CURLOPT_URL, "https://servicos.portaldasfinancas.gov.pt:700/fews/faturas");
curl_setopt($soap, CURLOPT_SSLCERT , "C:\wwwroot\www-php\projects\foxfact\TestesWebServices.pem" );
curl_setopt($soap, CURLOPT_SSLKEY , "C:\wwwroot\www-php\projects\foxfact\Testes__Web_Services_key" );
curl_setopt($soap, CURLOPT_SSLKEYPASSWD , "TESTEwebservice" );
curl_setopt($soap, CURLOPT_SSLVERSION, 3);
curl_setopt($soap, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($soap, CURLOPT_TIMEOUT, 15);
curl_setopt($soap, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap, CURLOPT_POST, true);
curl_setopt($soap, CURLOPT_POSTFIELDS, $this->xml);
curl_setopt($soap, CURLOPT_HTTPHEADER, $this->headers);

$result = curl_exec($soap);

if (curl_errno($soap) > 0) {
$result = array('errocurl' => curl_errno($soap), 'msgcurl' => curl_error($soap));
echo curl_error($soap);
// $result = false;
}

curl_close($soap);

return $result;

}
}

The error message I have in browser is following:
Curl Error : unable to use client certificate (no key found or wrong pass phrase?)
Can you have a look and advise me where I am getting wrong.

Best Regards
jokimen
 
Posts: 4
Joined: Wed Mar 07, 2012 4:41 pm

Return to Zend Server

Who is online

Users browsing this forum: Google [Bot], stalxed, Yahoo [Bot] and 5 guests