I want to connect to a secured site using PHP cURL. The site owners gave us four files:
- sitename.key
- sitename.p12
- sitename.pem
- icom-live-ca.pem
And the PEM pass phrase.
$curl_resource = curl_init ();
curl_setopt ( $curl_resource, CURLOPT_URL, $sHost );
curl_setopt ( $curl_resource, CURLOPT_POST, 1 );
curl_setopt ( $curl_resource, CURLOPT_POSTFIELDS, $post_string );
curl_setopt ( $curl_resource, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $curl_resource, CURLOPT_HTTPHEADER, $headerdata);
curl_setopt ( $curl_resource, CURLOPT_HEADER, true);
curl_setopt ( $curl_resource, CURLOPT_SSLCERT , HOMEDIR.'cert/icom-live-ca.pem');
curl_setopt ( $curl_resource, CURLOPT_SSLCERTPASSWD, 'PEM pass phrase');
curl_setopt ( $curl_resource, CURLOPT_SSLKEY, HOMEDIR.'cert/secure.key');
curl_setopt ( $curl_resource, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt ( $curl_resource, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ( $curl_resource, CURLOPT_SSLCERTTYPE, 'PEM');
I am getting the following error:
Unable to set private key file:'filepath'/secure.key type PEM.
I have not done any settings on my server. Do I need to install/change any setting at client server as well for accessing HTTPS sites?