PHP code example of hmerritt / imdb-api

1. Go to this page and download the library: Download hmerritt/imdb-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hmerritt / imdb-api example snippets


// Assuming you installed from Composer:
/ Search imdb
// -> returns array of films and people found
$imdb->search("Apocalypse");

// Get film data
// -> returns array of film data (title, year, rating...)
$imdb->film("tt0816692");

$imdb = new Imdb;

//  Options are passed as an array as the second argument
//  These are the default options
$imdb->film("tt0816692", [
    'cache'        => true,
    'curlHeaders'  => ['Accept-Language: en-US,en;q=0.5'],
    'techSpecs'    => true,
]);

$imdb->search("Interstellar", [
    'category'     => 'all',
    'curlHeaders'  => ['Accept-Language: en-US,en;q=0.5'],
]);

// Searches imdb and gets the film data of the first result
// -> will return the film data for 'Apocalypse Now'
$imdb->film("Apocalypse");