Im sure Im just doing something wrong, but whenever I try to search for anything with a space, it returns no results. "I am legend" for example returns nothing.
What I have:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.themoviedb.org/3/search/movie?api_key=REMOVED&query=$_GET[search]&page=$_GET[page]&include_adult=false&language=en&sort_by=popularity.desc");
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);
$json = json_decode($response);
$count = count($json->{'results'});
Kan du inte hitta en film eller tv-serie? Logga in för att skapa den.
Vill du betygsätta denna artikel eller lägga till den i en lista?
Inte medlem?
Svar från Jiinxt
den 25 oktober 2015 vid 10:58 AM
I figured it out, needed to add "%20" into the string.