Problème certificat cURL

Par Abdel37, il y a 5 ans


Bonjour,

Je rencontre un petit problème avec mon code sur le cours sur cURL.
Voici le code.

<?php $curl = curl_init('https://api.openweathermap.org/data/2.5/forecast?q={$city}&appid={$this-%3Eapikey}&units=metric'); curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . DIRECTORY_SEPARATOR . "cert.cer"); $data = curl_exec($curl); if ($data === false) { var_dump(curl_error($curl)); } else { } curl_close($curl); ?>

Je fais un var_dump de $curl et voilà l'erreur que ça me met.

C:\wamp64\www\grafikart\php\meteo.php:6:string 'SSL certificate problem: self signed certificate in certificate chain' (length=69)

Merci pour votre aide.

5 réponses

Grafikart, il y a 5 ans

D'où provient cert.cer ?

Abdel37, il y a 5 ans

Il vient des sources.

Grafikart, il y a 5 ans

Fait comme je le fais dans le tutoriel, télécharge le certificat plus récent.

Abdel37, il y a 5 ans

Ok merci. Je vais faire ça.

Abdel37, il y a 5 ans

Quand je retourne sur le site ça me met ce lien qui mène vers une clé :

api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key}

Est-ce que tu sais comment faire ?