[RESOLU] CURL et check ssl

Petit nouveau ! | 2 Messages

15 avr. 2015, 14:15

Bonjour à tous,

je suis en train de développer une interface utilisant une api externe.

Je peux faire plusieurs requêtes :

Code : Tout sélectionner

$curl = curl_init(); $url = $this->url . 'catalog/System/Workflow/'; $curlOptions = array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_SSLVERSION => 3, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_USERPWD => "$this->username:$this->password", CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true ); curl_setopt_array($curl, $curlOptions + $this->curlOptDefaults); $content = curl_exec($curl); if(curl_errno($curl) != 0) { echo "Error CURL : " . curl_error($curl); die(''); } $tabWorkFlows = json_decode($content, true);
Et ça marche très bien. Je peux également faire du post, et ça marche très bien aussi.
Toutefois, quand je rajoute l'option

Code : Tout sélectionner

CURLOPT_HTTPHEADER => 'Content-Type: application/xml'
il me renvoie toujours l'erreur :
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Alors que je laisse les options ssl_verifypeer et ssl verifyhost à 0. Quelqu'un a déjà rencontré ce problème ?

Si vous avez besoin d'autres infos, n'hésitez pas à demander...

Petit nouveau ! | 2 Messages

15 avr. 2015, 14:55

Ok, en fait, le CURLOPT_HTTPHEADER attend un array... corrigé et résolu.