├── .gitignore ├── CHANGES.md ├── LICENSE ├── README.md ├── class_IMDb.php └── tests ├── charts.php ├── id.php ├── person_id.php ├── person_name.php └── title.php /.gitignore: -------------------------------------------------------------------------------- 1 | # osx noise 2 | .DS_Store 3 | profile -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## v0.4.1 - June 22, 2012 4 | * Fixed: build_url() now generates a signature to sign the request, this fixes find_by_title() returning an empty result set. 5 | * Known Issue: Anonymising find_by_title() requests will always return an empty result set. As of writing this, the only solution is simply to set $anonymise to false. 6 | 7 | ## v0.4 - March 9, 2012 8 | * Added: Can now get top charts data including the Top 250, Bottom 100, and Box Office (US) 9 | 10 | ## v0.3 - March 8, 2012 11 | * Added: Can now search for people by name (or a person with their IMDb ID) (test files included) 12 | * Added: Film tagline now returned. 13 | * Added: Arrays of genres, writers, directors and actors are now returned in addition to a comma-separated list of them. 14 | * Fixed: PHP warning when film has no genres. 15 | * Fixed: Adult genre filter now checks all genres instead of only the first one listed. 16 | 17 | ## v0.2.3 - December 11, 2011 18 | * Added runtime (in minutes) to returned data from find_by_id(). 19 | 20 | ## v0.2.2 - December 11, 2011 21 | * find_by_title() now accepts optional 'year' parameter to limit results to titles from a given year 22 | 23 | ## v0.2.1 - December 11, 2011 24 | * Option to ignore certain types of film, by default, tv_series, tv_special and video_game types are ignored 25 | * Option to ignore Adult genre or X rated films - this is turned on by default 26 | * Option to override above settings and force a title to be returned with find_by_id() 27 | 28 | ## v0.2.0 - December 11, 2011 29 | * Summarised data now returned by default (as opposed to literally all information, which is not needed by most people) 30 | * Basic error handling - "response" key added to summarised data, 0 indicates a failure while 1 indicates success. 31 | * Stopped using American spellings for function and variable names 32 | * Can now limit number of titles returned when using find_by_title() (NOTE: IMDb will only return a maximum of 50 results) 33 | 34 | ## v0.1.0 - November 24, 2011 35 | * **Initial release** 36 | * Return movie data from IMDb ID 37 | * Return movies matching title 38 | * Anonymise requests to prevent IP address getting banned 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Chris Phillips 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IMDb PHP API 2 | 3 | ## How To Use 4 | 5 | ### Create an instance 6 | 7 | // IMDb ( [bool $anonymise = false [, bool $summary = true [, int $titlesLimit = 0]]] ) 8 | $imdb = new IMDb(true, true, 0); // anonymise requests to prevent IP address getting banned, summarise returned data, unlimited films returned 9 | 10 | 11 | ### Search for a movie by title 12 | 13 | // Returns an array containing objects of matching titles 14 | $movies = $imdb->find_by_title("The Godfather"); 15 | 16 | // $movies[0]->title => "The Godfather" 17 | // $movies[0]->year => "1972" 18 | // $movies[0]->tconst => "tt0068646" 19 | // ... 20 | // $movies[1]->title => "The Godfather: Part II" 21 | // ... 22 | 23 | ### Get a movie by its imdb_id 24 | 25 | // Returns an object containing the movie's data 26 | $movie = $imdb->find_by_id("tt0068646"); 27 | 28 | // $movie->title => "The Godfather" 29 | // $movie->rating => "8.1" 30 | // $movie->year => "1972" 31 | 32 | ### Search for a person by name 33 | 34 | // Returns an array containing objects of matching names 35 | $people = $imdb->person_by_name("Christian Bale"); 36 | 37 | // $people[0]->name => "Christian Bale" 38 | // $people[0]->nconst => "nm0000288" 39 | // ... 40 | 41 | ### Get a person by their imdb_id 42 | 43 | // Returns an object containing the person's data 44 | $person = $imdb->person_by_id("nm0000288"); 45 | 46 | // $person->name => "Christian Bale" 47 | // $person->birthday_datestamp => "1974-01-30" 48 | // $person->birthplace => "Haverfordwest, Pembrokeshire, Wales, UK" 49 | 50 | ### Charts 51 | 52 | // Returns an array containing objects of of the top 250 films 53 | $movies = $imdb->chart_top(); 54 | // Or for the Bottom 100... 55 | $movies = $imdb->chart_bottom(); 56 | 57 | // $movies[0]->title => "The Shawshank Redemption" 58 | // $movies[0]->year => "1994" 59 | // $movies[0]->tconst => "tt0111161" 60 | // ... 61 | // $movies[1]->title => "The Godfather" 62 | // ... 63 | 64 | // Similarly, the following function will return the Box Office (US) respectively. 65 | // Note that the format of the data returned differs slightly from the above 2 charts 66 | $movies = $imdb->boxoffice(); 67 | -------------------------------------------------------------------------------- /class_IMDb.php: -------------------------------------------------------------------------------- 1 | 'v1', 8 | 'appid' => 'iphone1_1', 9 | 'apiPolicy' => 'app1_1', 10 | 'apiKey' => '2wex6aeu6a8q9e49k7sfvufd6rhh0n', 11 | 'locale' => 'en_US', 12 | 'timestamp' => '0', 13 | ); 14 | private $anonymiser = 'http://anonymouse.org/cgi-bin/anon-www.cgi/'; // URL that will be prepended to the generated API URL. 15 | public $anonymise = false; 16 | public $summary = true; // Set to true to return a summary of the film's details. Set to false to return everything. 17 | public $titlesLimit = 0; // Limit the number of films returned by find_by_title() when summarised. 0 = unlimited (NOTE: IMDb returns a maximum of 50 results). 18 | 19 | // You can prevent certain types of titles being returned. IMDb classifies titles under one of the following categories: 20 | // feature, short, documentary, video, tv_series, tv_special, video_game 21 | // Titles whose category is in the $ignoreTypes array below will be removed from your results 22 | public $ignoreTypes = array('tv_series','tv_special','video_game'); 23 | 24 | // By default, X rated titles and titles in the genre 'Adult' will also be ignored. Set to false to allow them. 25 | public $ignoreAdult = true; 26 | 27 | // Setting the following option to true will allow you to override any ignore options and force the title to be returned with find_by_id() 28 | public $forceReturn = false; 29 | 30 | function __construct($anonymise=false, $summary=true, $titlesLimit=0){ 31 | $this->anonymise = $anonymise; // should we anonymise requests? 32 | if(!$summary) $this->summary=false; // overriding the default? 33 | if(intval($titlesLimit)>0) $this->titlesLimit = intval($titlesLimit); // Set titles limit if required 34 | } 35 | 36 | // Build URL based on the given parameters 37 | function build_url($method, $query="", $parameter=""){ 38 | 39 | // Set timestamp parameter to current time 40 | $this->params['timestamp'] = $_SERVER['REQUEST_TIME']; 41 | 42 | // Build the URL and append query if we have one 43 | $unsignedUrl = $this->baseurl.$method.'?'.http_build_query($this->params); 44 | if(!empty($parameter) AND !empty($query)) $unsignedUrl .= '&'.$parameter.'='.urlencode($query); 45 | 46 | // Generate a signature and append to unsignedUrl to sign it. 47 | $sig = hash_hmac('sha1', $unsignedUrl, $this->params['apiKey']); 48 | $signedUrl = $unsignedUrl.'&sig=app1-'.$sig; 49 | 50 | // Anonymise the request? 51 | $signedUrl = $this->anonymise ? $this->anonymiser.$signedUrl : $signedUrl; 52 | 53 | return $signedUrl; 54 | } 55 | 56 | // Search IMDb by ID of film 57 | function find_by_id($id){ 58 | if(strpos($id, "tt")!==0) $id = "tt".$id; 59 | $requestURL = $this->build_url('title/maindetails', $id, 'tconst'); 60 | $json = $this->fetchJSON($requestURL); 61 | 62 | if(is_object($json->error)){ 63 | $data = $this->errorResponse($json->error); 64 | } 65 | else{ 66 | $data = $this->summary ? $this->summarise($json->data) : $json->data; 67 | } 68 | 69 | return $data; 70 | } 71 | 72 | // Search IMDb by title of film 73 | function find_by_title($title, $year=0){ 74 | $requestURL = $this->build_url('find', $title, 'q'); 75 | $json = $this->fetchJSON($requestURL); 76 | 77 | // We'll usually have several "lists" returned in the JSON. Combine all these into one array. 78 | if(empty($json->data->results)){ 79 | // IMDb doesn't return a proper error response in the event of 0 results being returned 80 | // so set our own failure message. 81 | $error->message = "No results found."; 82 | $matches = $this->errorResponse($error, true); 83 | } 84 | else{ 85 | $results = $json->data->results; 86 | $matches = array(); 87 | 88 | if($this->summary){ 89 | $matches = $this->summarise_titles($results, intval($year)); 90 | } 91 | else{ 92 | for($i=0; $ilist); 94 | } 95 | } 96 | } 97 | 98 | return $matches; 99 | } 100 | 101 | // Search IMDb by ID of person 102 | function person_by_id($id){ 103 | if(strpos($id, "nm")!==0) $id = "nm".$id; 104 | $requestURL = $this->build_url('name/maindetails', $id, 'nconst'); 105 | $json = $this->fetchJSON($requestURL); 106 | 107 | if(is_object($json->error)){ 108 | $data = $this->errorResponse($json->error); 109 | } 110 | else{ 111 | $data = $this->summary ? $this->summarise_person($json->data) : $json->data; 112 | } 113 | 114 | return $data; 115 | } 116 | 117 | // Search IMDb by name of person 118 | function person_by_name($name){ 119 | $requestURL = $this->build_url('find', $name, 'q'); 120 | $json = $this->fetchJSON($requestURL); 121 | 122 | // We'll usually have several "lists" returned in the JSON. Combine all these into one array. 123 | if(empty($json->data->results)){ 124 | // IMDb doesn't return a proper error response in the event of 0 results being returned 125 | // so set our own failure message. 126 | $error->message = "No results found."; 127 | $matches = $this->errorResponse($error, true); 128 | } 129 | else{ 130 | $results = $json->data->results; 131 | $matches = array(); 132 | 133 | if($this->summary){ 134 | $matches = $this->summarise_people($results); 135 | } 136 | else{ 137 | for($i=0; $ilist); 139 | } 140 | } 141 | } 142 | 143 | return $matches; 144 | } 145 | 146 | // Top 250 Chart 147 | function chart_top(){ 148 | $requestURL = $this->build_url('chart/top'); 149 | $json = $this->fetchJSON($requestURL); 150 | 151 | if(is_object($json->error)){ 152 | $data = $this->errorResponse($json->error); 153 | } 154 | else{ 155 | $data = $json->data->list->list; 156 | } 157 | 158 | return $data; 159 | } 160 | 161 | // Bottom 100 Chart 162 | function chart_bottom(){ 163 | $requestURL = $this->build_url('chart/bottom'); 164 | $json = $this->fetchJSON($requestURL); 165 | 166 | if(is_object($json->error)){ 167 | $data = $this->errorResponse($json->error); 168 | } 169 | else{ 170 | $data = $json->data->list->list; 171 | } 172 | 173 | return $data; 174 | } 175 | 176 | // Box Office (US) 177 | function boxoffice(){ 178 | $requestURL = $this->build_url('boxoffice'); 179 | $json = $this->fetchJSON($requestURL); 180 | 181 | if(is_object($json->error)){ 182 | $data = $this->errorResponse($json->error); 183 | } 184 | else{ 185 | $data = $json->data; 186 | } 187 | 188 | return $data; 189 | } 190 | 191 | // Summarise - only return the most pertinent data (when returning data from IMDb ID) 192 | function summarise($obj){ 193 | 194 | // If this is not an ignored type... 195 | if(!$this->is_ignored($obj->type, $obj->certificate->certificate, $obj->genres)){ 196 | // ID with and without 'tt' prefix 197 | $s->id = substr($obj->tconst, 2); 198 | $s->tconst = $obj->tconst; 199 | 200 | // Title 201 | $s->title = $obj->title; 202 | 203 | // Year 204 | $s->year = $obj->year; 205 | 206 | // Plot and Tagline 207 | $s->plot = $obj->plot->outline; 208 | $s->tagline = $obj->tagline; 209 | 210 | // Votes + Rating 211 | $s->rating = $obj->rating; 212 | $s->votes = $obj->num_votes; 213 | 214 | // Genres 215 | if(is_array($obj->genres)){ 216 | $s->genre = implode(", ", $obj->genres); 217 | $s->genres = $obj->genres; 218 | }else{ 219 | $s->genre = ""; 220 | $s->genres = ""; 221 | } 222 | 223 | // Writers 224 | if(is_array($obj->writers_summary)){ 225 | $i=0; 226 | foreach($obj->writers_summary as $writers){ 227 | $writer[$i] = $writers->name->name; 228 | $s->writers_summary[$i]['nconst'] = $writers->name->nconst; 229 | $s->writers_summary[$i]['name'] = $writers->name->name; 230 | $s->writers_summary[$i]['attr'] = $writers->attr; 231 | $i++; 232 | } 233 | $s->writer = implode(", ", $writer); 234 | }else{ 235 | $s->writer = ""; 236 | $s->writers_summary = ""; 237 | } 238 | 239 | // Directors 240 | if(is_array($obj->directors_summary)){ 241 | $i=0; 242 | foreach($obj->directors_summary as $directors){ 243 | $director[] = $directors->name->name; 244 | $s->directors_summary[$i]['nconst'] = $directors->name->nconst; 245 | $s->directors_summary[$i]['name'] = $directors->name->name; 246 | $i++; 247 | } 248 | $s->director = implode(", ", $director); 249 | }else{ 250 | $s->director = ""; 251 | $s->directors_summary = ""; 252 | } 253 | 254 | // Cast 255 | if(is_array($obj->cast_summary)){ 256 | $i=0; 257 | foreach($obj->cast_summary as $cast){ 258 | $actor[] = $cast->name->name; 259 | $s->cast_summary[$i]['nconst'] = $cast->name->nconst; 260 | $s->cast_summary[$i]['name'] = $cast->name->name; 261 | $s->cast_summary[$i]['char'] = $cast->char; 262 | $i++; 263 | } 264 | $s->actors = implode(", ", $actor); 265 | }else{ 266 | $s->actors = ""; 267 | $s->cast_summary = ""; 268 | } 269 | 270 | // Shorthand release date in the format of 'd MMM YYYY' and datestamp 271 | $s->released = !empty($obj->release_date->normal) ? date('j M Y', strtotime($obj->release_date->normal)) : ""; 272 | $s->release_datestamp = $obj->release_date->normal; 273 | 274 | // Runtime 275 | $s->runtime = round($obj->runtime->time/60); 276 | 277 | // Certificate 278 | $s->certificate = $obj->certificate->certificate; 279 | 280 | // Poster 281 | $s->poster = $obj->image->url; 282 | 283 | // Type 284 | $s->type = $obj->type; 285 | 286 | // Response messages 287 | $s->response = 1; 288 | $s->response_msg = "Success"; 289 | } 290 | else{ 291 | // Response messages 292 | $s->response = 0; 293 | $s->response_msg = "Fail"; 294 | $s->message = "Film type is ignored."; 295 | } 296 | 297 | return $s; 298 | } 299 | 300 | // Summarise - only return the most pertinent data (when returning multiple title data) 301 | function summarise_titles($objs, $yearMatch=0){ 302 | 303 | $t=0; 304 | 305 | for($i=0; $ilist; 307 | 308 | // In each "list" of results we only want to return titles so ignore other results such as actors, characters etc. 309 | foreach($list as $obj){ 310 | if(!empty($obj->tconst) AND !$this->is_ignored($obj->type) AND $this->yearMatch($obj->year, $yearMatch)){ 311 | // ID with and without 'tt' prefix 312 | $s[$t]->id = substr($obj->tconst, 2); 313 | $s[$t]->tconst = $obj->tconst; 314 | 315 | // Title 316 | $s[$t]->title = $obj->title; 317 | 318 | // Year 319 | $s[$t]->year = $obj->year; 320 | 321 | // Comma-seperated list of actors 322 | $actor = array(); 323 | if(is_array($obj->principals)){ 324 | foreach($obj->principals as $cast){ $actor[] = $cast->name; } 325 | $s[$t]->actors = implode(", ", $actor); 326 | }else{ 327 | $s[$t]->actors = ""; 328 | } 329 | 330 | // Poster 331 | $s[$t]->poster = $obj->image->url; 332 | 333 | // Type 334 | $s[$t]->type = $obj->type; 335 | 336 | $t++; 337 | 338 | // Reached limit of titles? 339 | if($t==$this->titlesLimit) break 2; 340 | } 341 | } 342 | } 343 | 344 | // Response messages 345 | if($t>0){ 346 | $s['response'] = 1; 347 | $s['response_msg'] = "Success"; 348 | } 349 | else{ 350 | $s['response'] = 0; 351 | $s['response_msg'] = "Fail"; 352 | } 353 | 354 | return $s; 355 | } 356 | 357 | // Summarise Person - only return the most pertinent data (when returning data from IMDb ID) 358 | function summarise_person($obj){ 359 | 360 | // ID with and without 'tt' prefix 361 | $s->id = substr($obj->nconst, 2); 362 | $s->nconst = $obj->nconst; 363 | 364 | // Name 365 | $s->name = $obj->name; 366 | $s->real_name = $obj->real_name; 367 | 368 | // Biography 369 | $s->bio = $obj->bio; 370 | 371 | // Birth and Death 372 | $s->birthday = !empty($obj->birth->date->normal) ? date('j M Y', strtotime($obj->birth->date->normal)) : ""; 373 | $s->birthday_datestamp = $obj->birth->date->normal; 374 | $s->birthplace = $obj->birth->place; 375 | $s->deathday = !empty($obj->death->date->normal) ? date('j M Y', strtotime($obj->death->date->normal)) : ""; 376 | $s->deathday_datestamp = $obj->death->date->normal; 377 | $s->deathplace = $obj->death->place; 378 | 379 | // Known For 380 | $s->known_for = $obj->known_for; 381 | 382 | // Image 383 | $s->image = $obj->image->url; 384 | $s->photos = $obj->photos; 385 | 386 | // Response messages 387 | $s->response = 1; 388 | $s->response_msg = "Success"; 389 | 390 | return $s; 391 | } 392 | 393 | // Summarise - only return the most pertinent data (when returning multiple title data) 394 | function summarise_people($objs){ 395 | 396 | $t=0; 397 | 398 | for($i=0; $ilist; 400 | 401 | // In each "list" of results we only want to return titles so ignore other results such as actors, characters etc. 402 | foreach($list as $obj){ 403 | if(!empty($obj->nconst)){ 404 | // ID with and without 'tt' prefix 405 | $s[$t]->id = substr($obj->nconst, 2); 406 | $s[$t]->nconst = $obj->nconst; 407 | 408 | // Name 409 | $s[$t]->name = $obj->name; 410 | 411 | // Known For 412 | $s[$t]->known_for = $obj->known_for; 413 | 414 | // Image 415 | $s[$t]->image = $obj->image->url; 416 | 417 | $t++; 418 | 419 | // Reached limit of titles? 420 | if($t==$this->titlesLimit) break 2; 421 | } 422 | } 423 | } 424 | 425 | // Response messages 426 | if($t>0){ 427 | $s['response'] = 1; 428 | $s['response_msg'] = "Success"; 429 | } 430 | else{ 431 | $s['response'] = 0; 432 | $s['response_msg'] = "Fail"; 433 | } 434 | 435 | return $s; 436 | } 437 | 438 | // Check if a title should be ignored. Returns true for yes, false for no. 439 | function is_ignored($type, $cert="", $genre=array()){ 440 | if($this->forceReturn) return false; 441 | if(in_array($type, $this->ignoreTypes)) return true; 442 | if($this->ignoreAdult AND ($cert=="X" OR (!empty($genre) AND in_array("Adult",$genre)))) return true; 443 | 444 | return false; 445 | } 446 | 447 | // Check year matches 448 | function yearMatch($year, $yearMatch){ 449 | if($yearMatch===0) return true; 450 | if($yearMatch==$year) return true; 451 | return false; 452 | } 453 | 454 | // Basic error handling 455 | function errorResponse($obj, $returnArray=false){ 456 | $s->status = $obj->status; 457 | $s->code = $obj->code; 458 | $s->message = $obj->message; 459 | $s->response = 0; 460 | $s->response_msg = "Fail"; 461 | 462 | if($returnArray) return (array)$s; 463 | else return $s; 464 | } 465 | 466 | 467 | // Perform CURL request on the API URL to fetch the JSON data 468 | function fetchJSON($apiUrl){ 469 | $ch = curl_init($apiUrl); 470 | $headers[] = 'Connection: Keep-Alive'; 471 | $headers[] = 'Content-type: text/plain;charset=UTF-8'; 472 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 473 | curl_setopt($ch, CURLOPT_HEADER, 0); 474 | curl_setopt($ch, CURLOPT_TIMEOUT, 0); 475 | curl_setopt($ch, CURLOPT_ENCODING , 'deflate'); 476 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 477 | curl_setopt($ch, CURLOPT_VERBOSE, 1); 478 | $json = curl_exec($ch); 479 | $curl_errno = curl_errno($ch); 480 | $curl_error = curl_error($ch); 481 | curl_close($ch); 482 | 483 | // Errors? 484 | if ($curl_errno > 0){ 485 | $data->error->message = 'cURL Error '.$curl_errno.': '.$curl_error; 486 | } 487 | else{ 488 | // Decode the JSON response 489 | $data = json_decode($json); 490 | } 491 | 492 | return $data; 493 | } 494 | 495 | } 496 | ?> -------------------------------------------------------------------------------- /tests/charts.php: -------------------------------------------------------------------------------- 1 | "Top 250", 8 | "bottom" => "Bottom 100", 9 | "boxoffice" => "Box Office (US)" 10 | ); 11 | foreach($charts as $cid => $cname){ 12 | if($chart==$cid) $s=' selected="selected"'; 13 | $options .= ''."\n"; 14 | unset($s); 15 | } 16 | ?> 17 | 18 | 19 | 20 | 21 | Charts - IMDb-PHP-API 22 | 23 | 24 | 25 |

Various charts from IMDb.

26 |
27 | 30 | 31 |
32 | 33 | Results'; 35 | if($chart=="top") $movies = $imdb->chart_top(); 36 | else if($chart=="bottom") $movies = $imdb->chart_bottom(); 37 | else if($chart=="boxoffice") $movies = $imdb->boxoffice(); 38 | 39 | print '
';
40 | if($movies) print_r($movies);
41 | print '
'; 42 | ?> 43 | 44 | 45 | -------------------------------------------------------------------------------- /tests/id.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | Find by ID - IMDb-PHP-API 12 | 13 | 14 | 15 |

Enter a movie's IMDb ID to return its data. Example: tt0068646

16 |
17 |
18 | /> 19 |
20 |
21 | 22 | Results'; 25 | if($_GET['nosummary']=="on") $imdb->summary=false; 26 | $movie = $imdb->find_by_id($q); 27 | 28 | print '
';
29 | 	print_r($movie);
30 | 	print '
'; 31 | } 32 | ?> 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/person_id.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | Person by ID - IMDb-PHP-API 12 | 13 | 14 | 15 |

Enter a person's IMDb ID to return their data. Example: nm0000288

16 |
17 |
18 | /> 19 |
20 |
21 | 22 | Results'; 25 | if($_GET['nosummary']=="on") $imdb->summary=false; 26 | $person = $imdb->person_by_id($q); 27 | 28 | print '
';
29 | 	print_r($person);
30 | 	print '
'; 31 | } 32 | ?> 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/person_name.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | Person by Name - IMDb-PHP-API 13 | 14 | 15 | 16 |

Enter a search term to return data for matching names. Example: Christian Bale

17 |
18 |
19 | />
20 | Max. people returned 21 |
22 |
23 | 24 | Results'; 27 | if($_GET['nosummary']=="on") $imdb->summary=false; 28 | if(intval($_GET['limit'])>0) $imdb->titlesLimit = intval($_GET['limit']); 29 | $people = $imdb->person_by_name($q); 30 | 31 | print '
';
32 | 	print_r($people);
33 | 	print '
'; 34 | } 35 | ?> 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/title.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | Find by Title - IMDb-PHP-API 13 | 14 | 15 | 16 |

Enter a search term to return data for matching movie titles. Example: The Godfather

17 |
18 |
19 | Specify year (Optional)
20 | />
21 | Max. titles returned 22 |
23 |
24 | 25 | Results'; 28 | if($_GET['nosummary']=="on") $imdb->summary=false; 29 | if(intval($_GET['limit'])>0) $imdb->titlesLimit = intval($_GET['limit']); 30 | $movies = $imdb->find_by_title($q, $year); 31 | 32 | print '
';
33 | 	print_r($movies);
34 | 	print '
'; 35 | } 36 | ?> 37 | 38 | 39 | --------------------------------------------------------------------------------