I'm trying to get a specific movie from IMDB using the IMDO api, It's working great if there is only 1 movie with the title I'm searching for.
But if there are multiple movies, I one get the first, sorted by year I'm assuming.
How can I get all of the movies with the title?
I doing it in PHP.
<?php
//Get movie data
if($_GET['title']){
$titleInput = "t=" . str_replace(' ', '+', $_GET['title']);
$jsonUrl = "http://www.omdbapi.com/?" . $titleInput;
}else if($_GET['imdbid']){
$titleInput = "i=" . str_replace(' ', '+', $_GET['imdbid']);
$jsonUrl = "http://www.omdbapi.com/?" . $titleInput;
}
$jsonRaw = file_get_contents($jsonUrl);
$movieArray = json_decode($jsonRaw, true);
?>
If you want to get multiple results by title use the s=title
instead of the t=title
parameter as documented here.
As far as I understood it the "By Search" parameter can return multiple results whereas the "By ID or Title" parameter will return a single one.