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 ikke finde en film eller TV-serie? Log in og opret den.
Want to rate or add this item to a list?
Ikke medlem?
Svar af Jiinxt
d. 25 oktober 2015 kl. 10:58 AM
I figured it out, needed to add "%20" into the string.