if (!$mi) { $m->updateMovieInfo($_REQUEST["add"]); } $usermovies = $um->addMovie($users->currentUserId(), $_REQUEST["add"], $cats); } else { if (!isset($_REQUEST["id"])) { $page->show404(); } $m = new Movie(false); if (is_numeric($_REQUEST["id"])) { $prop = $m->fetchTmdbProperties($_REQUEST["id"]); if ($prop !== false) { $res = array($prop); } } else { $res = $m->searchTmdb($_REQUEST["id"]); } $imdbids = array(); if ($res) { foreach ($res as $movie) { if (isset($movie['title']) && isset($movie['imdb_id'])) { $imdbids[] = str_replace("tt", "", $movie['imdb_id']); } else { // no results } } if (count($imdbids) == 0) { print "<h3 style='padding-top:30px;'>No results found</h3>"; } else { $ourmovieimdbs = array(); if (count($imdbids) > 0) {
<?php // search tmdb or web for movie from a given name define('FS_ROOT', realpath(dirname(__FILE__))); require_once FS_ROOT . "/../../www/config.php"; require_once FS_ROOT . "/../../www/lib/framework/db.php"; require_once FS_ROOT . "/../../www/lib/movie.php"; require_once FS_ROOT . "/../../www/lib/util.php"; $movienameorig = "A Movie Name"; $movie = new Movie(); $moviename = $movie->parseMovieName($movienameorig); echo "Looking up " . $movienameorig . " - " . $moviename . "\n"; // #1 tmdb // echo "TMDB : \n"; print_r($movie->searchTmdb($moviename)); // #2 search engine (google/bing) //$buffer = getUrl("https://www.google.com/search?source=ig&hl=en&rlz=&btnG=Google+Search&aq=f&oq=&q=".urlencode($moviename.' site:imdb.com')); echo "\nSE : \n"; $buffer = getUrl("http://www.bing.com/search?&q=" . urlencode($moviename . ' site:imdb.com')); if ($buffer !== false && strlen($buffer)) { $imdb = $movie->parseImdbFromNfo($buffer); echo sprintf("imdbid : %s\n", $imdb); print_r($movie->fetchImdbProperties($imdb)); echo "\nTMDB:\n"; print_r($movie->fetchTmdbProperties($imdb)); }