I'm testing an API that uses
Код: Выделить всё
curl_exec
I have configured SSL on my apache VirtualHost and looks ok ( opening
Код: Выделить всё
https:://[myVHost]
However the API curl call give me back this message:
Код: Выделить всё
SSL peer certificate or SSH remote key was not OK
I'm not very experienced with SSL so I have few ideas about the cause of that.
UPDATE:
This is the code I'm using in my cURL request, I have commented 2 lines and changes their value (look at 'TODO' line ) and in this way it is working, however this is just a work arround ...
Код: Выделить всё
$opts[CURLOPT_URL] = $url; $opts[CURLOPT_RETURNTRANSFER] = true; $opts[CURLOPT_CONNECTTIMEOUT] = 50; $opts[CURLOPT_TIMEOUT] = 100; $headers = array( 'Accept: application/json', "User-Agent: APIXXX-PHP-Client"); $opts[CURLOPT_HTTPHEADER] = $headers; $opts[CURLOPT_USERPWD] = $env->getApiKey() . ':'; if (certificatePresent()) { // $opts[CURLOPT_SSL_VERIFYPEER] = true; // $opts[CURLOPT_SSL_VERIFYHOST] = 2; // TODO: SET IT BACK $opts[CURLOPT_SSL_VERIFYPEER] = 0; $opts[CURLOPT_SSL_VERIFYHOST] = 0; $opts[CURLOPT_CAINFO] = $path } curl_setopt_array($curl, $opts); $response = curl_exec($curl);
Источник: https://stackoverflow.com/questions/141 ... was-not-ok