Hello guys,
I am very new to APIs and this was the first time using it. I programmed everything in php and it worked fine for me on localhost on my PC. To have access on the database on my entire network, I wanted to install the database on a linux vserver (Debian 7.0 Wheezy Minimalsystem (64 Bit) I set up Apache, phpmyadmin and stuff and everything works except for the api connection that had worked on localhost. Here is my code, maybe someone knows where the problem is, maybe I have just forgotten to install a package.
<?php
$ca = curl_init();
curl_setopt($ca, CURLOPT_URL, "http://api.themoviedb.org/3/configuration?api_key=###");
curl_setopt($ca, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ca, CURLOPT_HEADER, FALSE);
curl_setopt($ca, CURLOPT_HTTPHEADER, array("Accept: application/json"));
$response = curl_exec($ca);
curl_close($ca);
$config = json_decode($response, true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.themoviedb.org/3/movie/131631?api_key=###&append_to_response=releases&language=de");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
echo var_dump($result) //returns nothing
?>
¿No encuentras una película o serie? Inicia sesión para crearla:
¿Quieres puntuar o añadir este elemento a una lista?
¿No eres miembro?
Contestado por Sdi
el 3 de septiembre de 2014 a las 09:44
I solved the issue by myself. It was a package that has missed. For everyone who may have the same problem : The curl package missed, to get it, type: "apt-get install php5-curl"
Have a nice day.