a few words about web development

Find movies, get information about movies & actors

Another straight to the point solution
Previously this post was about fetching information directly from IMDB.com but this method failed when IMDB changed their layout.
So here's a different approach- getting movie and TV show information from a free database using API from REST7.com.

We can get information using IMDB ID:
$data = json_decode(file_get_contents('http://api.rest7.com/v1/movie_info.php?imdb=tt0133093'));
if ($data->success)
{
    print_r($data->movies[0]);
}
Or using movie title:
$data= json_decode(file_get_contents('http://api.rest7.com/v1/movie_info.php?title=Matrix'));
if ($data->success)
{
    foreach ($data->movies AS $movie)
    {
        print_r($movie);
    }
}
The latter method returns up to 5 movies with a title similar or identical to the one we searched for.

Comments