Soporte de The Movie Database

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 respuesta (en la página 1 de 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.

¿No encuentras una película o serie? Inicia sesión para crearla:

Global

s centrar la barra de búsqueda
p abrir menú de perfil
esc cierra una ventana abierta
? abrir la ventana de atajos del teclado

En las páginas multimedia

b retrocede (o a padre cuando sea aplicable)
e ir a la página de edición

En las páginas de temporada de televisión

(flecha derecha) ir a la temporada siguiente
(flecha izquierda) ir a la temporada anterior

En las páginas de episodio de televisión

(flecha derecha) ir al episodio siguiente
(flecha izquierda) ir al episodio anterior

En todas las páginas de imágenes

a abrir la ventana de añadir imagen

En todas las páginas de edición

t abrir la sección de traducción
ctrl+ s enviar formulario

En las páginas de debate

n crear nuevo debate
w cambiar el estado de visualización
p cambiar público/privado
c cambiar cerrar/abrir
a abrir actividad
r responder al debate
l ir a la última respuesta
ctrl+ enter enviar tu mensaje
(flecha derecha) página siguiente
(flecha izquierda) página anterior

Configuraciones

¿Quieres puntuar o añadir este elemento a una lista?

Iniciar sesión