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'});
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de Jiinxt
le 25 octobre 2015 à 10h58
I figured it out, needed to add "%20" into the string.