Our site has recently switched from http to https. It has REST API calls caused by our clients, which now do not work:
cURL before SSL (works):
$ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$api_call_url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$post_fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch);
cURL after SSL (does not work):
$ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$api_call_url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$post_fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, "/customers_path_on_their_server/to/our_cacert_they_exported_via_firefox.crt"); //X.509 Certificate $result = curl_exec($ch); curl_close($ch);
Do I need to configure anything on our server, except to ask the client to add CURLOPT_SSL_VERIFYPEER, CURLOPT_SSL_VERIFYHOST, CURLOPT_CAINFO to my REST integration code?
I am really new to https and I don’t know what exactly is the term that I need to search, look for cURL SSL for several hours now ...
By the way, our site uses amazon ec2 hosting, if this information is important ...
Here is the cURL error returned:
error:SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
cURL version: 7.21.6
SSL Version: OpenSSL / 1.0.0e