Assistance de TMDB

Hi new user here, before sending random requests and making the server self destruct.... well that's the level of luck i have i thought id test php code generated by the try it yourself examples in the api documentation.

the code generation for php generated https://developers.themoviedb.org/3/credits gave the following error:

cURL Error #:SSL certificate problem: unable to get local issuer certificate

The php tested was

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.themoviedb.org/3/credit/%7Bcredit_id%7D?api_key=apikeyremoved",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "{}",
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}?>

I am using AMPPS like wamps but imho better to test locally. can anyone offer any pointers to correct this?

Many thanks

NW

1 réponse (sur la page 1 sur 1)

Jump to last post

If I was to guess, it's the issue that is mentioned down the page a bit, here (this link should take you to the answer I'm referencing). I think you need to update the local certificates that cURL is using. If you don't want to to do this the only option is to tell cURL to not verify the host. Which I think is this command:

curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);

I'm not clear if you also need this line (maybe?):

curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);

But, having said all of this, if you're not interested in validating SSL, you might as well just use http instead in which case none of this applies and just update the URL.

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenêtre ouverte
? Ouvrir la fenêtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenêtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion