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
?>
找不到电影或节目?登录并创建它吧。
Sdi 的回复
于 2014 年 09 月 03 日 9: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.