Our site recently shifted from http to https. It has REST API calls called by our customers which is now not working:
cURL before SSL (working):
$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(not working):
$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 setup anything on our server other than ask client to add CURLOPT_SSL_VERIFYPEER, CURLOPT_SSL_VERIFYHOST, CURLOPT_CAINFO on their REST integration code?
I'm really a newbie in https and I don't know what exactly is the term I need to search, searched cURL SSL for hours already...
BTW, our site is using amazon ec2 hosting if that information is important...
Here is the returned cURL error:
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
CURLOPT_SSL_VERIFYPEER, 0
andCURLOPT_SSL_VERIFYHOST, 0
to solve this Error, you don't need to add certs. (You don't need to verify if you trust the source). – Richia