Skip to content

Instantly share code, notes, and snippets.

@silalahi
Created February 13, 2012 19:00
Show Gist options
  • Save silalahi/1819098 to your computer and use it in GitHub Desktop.
Save silalahi/1819098 to your computer and use it in GitHub Desktop.
Wrapper Class IMDb API PHP
<?php
// Dont forget to include class
require_once(dirname(__FILE__) . '/libraries/imdb.php');
// Instance
$imdb = new imdb();
// Search
$imdb->search('shawshank redemption');
// Look if movie exists
if($imdb->exists())
{
// Listing all available vars
echo "<strong>Title: </strong>" . $imdb->title . "<br>";
echo "<strong>Year: </strong>" . $imdb->year . "<br>";
echo "<strong>Rated: </strong>" . $imdb->rated . "<br>";
echo "<strong>Released: </strong>" . $imdb->released . "<br>";
echo "<strong>Genre: </strong>" . $imdb->genre . "<br>";
echo "<strong>Director: </strong>" . $imdb->director . "<br>";
echo "<strong>Writer: </strong>" . $imdb->writer . "<br>";
echo "<strong>Actors: </strong>" . $imdb->actors . "<br>";
echo "<strong>Plot: </strong>" . $imdb->plot . "<br>";
echo "<strong>Poster: </strong>" . $imdb->poster . "<br>";
echo "<strong>Runtime: </strong>" . $imdb->runtime . "<br>";
echo "<strong>Rating: </strong>" . $imdb->rating . "<br>";
echo "<strong>Votes: </strong>" . $imdb->votes . "<br>";
echo "<strong>IMDB ID: </strong>" . $imdb->id . "<br>";
}
else
{
echo "Sorry, movie doesn't exists";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment