Exemplo n.º 1
0
 public function testSearchMovie()
 {
     /**
      * @covers \
      */
     $config = parse_ini_file('./api.ini');
     $tmdb = new TMDB($config['apikey'], 'en');
     $movies = $tmdb->searchMovie("underworld");
     $this->assertCount(20, $movies);
 }
Exemplo n.º 2
0
<?php

include "./bootstrap.php";
print_header();
$config = parse_ini_file('../api.ini');
if (!isset($config['apikey'])) {
    print '<p class="error">Error: Unable to locate api key, please contact administrator</p>';
} else {
    if ($_GET['search'] === 'Search' and isset($_GET['searchterm'])) {
        $searchterm = filter_var($_GET['searchterm'], FILTER_SANITIZE_ENCODED);
        // had issues with filter_var returning nullset so we make sure that we have data
        if (isset($searchterm) and $searchterm != false) {
            $tmdb = new TMDB($config['apikey'], 'en');
            if ($_GET['type'] === 'Movie') {
                $movies = $tmdb->searchMovie($searchterm);
                if (count($movies) > 0) {
                    // I like proper formatting in pages. It makes it easier on the eyes
                    print_movieresults($movies);
                } else {
                    echo '<p class="error">No Movies found with the terms ', $searchterm, '</p>';
                }
            } elseif ($_GET['type'] === 'Actor') {
                $actors = $tmdb->searchPerson($searchterm);
                if (count($actors) > 0) {
                    // I like proper formatting in pages. It makes it easier on the eyes
                    print_actorresults($actors);
                } else {
                    echo '<p class="error">No Actors found with the terms ', $searchterm, '</p>';
                }
            }
        }
Exemplo n.º 3
0
<!DOCTYPE html>
<html>
    <head>
        <title>API usage for Movies</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="utf-8" />
    </head>
    <body>
        <?php 
include "../tmdb-api.php";
$apikey = "Your API Key";
$tmdb = new TMDB($apikey, 'en', true);
echo '<h2>API Usage for Movies examples</h2>';
// 1. Search Movie
echo '<ol><li><a id="searchMovie"><h3>Search Movie</h3></a><ul>';
$movies = $tmdb->searchMovie("underworld");
foreach ($movies as $movie) {
    echo '<li>' . $movie->getTitle() . ' (<a href="https://www.themoviedb.org/movie/' . $movie->getID() . '">' . $movie->getID() . '</a>)</li>';
}
echo '</ul></li><hr>';
// 2. Full Movie Info
echo '<li><a id="movieInfo"><h3>Full Movie Info</h3></a>';
$movie = $tmdb->getMovie(11);
echo 'Now the <b>$movie</b> var got all the data, check the <a href="http://code.octal.es/php/tmdb-api/class-Movie.html">documentation</a> for the complete list of methods.<br><br>';
echo '<b>' . $movie->getTitle() . '</b><ul>';
echo '  <li>ID:' . $movie->getID() . '</li>';
echo '  <li>Tagline:' . $movie->getTagline() . '</li>';
echo '  <li>Trailer: <a href="https://www.youtube.com/watch?v=' . $movie->getTrailer() . '">link</a></li>';
echo '</ul>...';
echo '<img src="' . $tmdb->getImageURL('w185') . $movie->getPoster() . '"/></li>';
// 3. Now Playing Movies
Exemplo n.º 4
0
<!DOCTYPE html>
<html>
    <head>
        <title>API usage for TVShows</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="utf-8" />
    </head>
    <body>
        <?php 
include "../tmdb-api.php";
$apikey = "Your API Key";
$tmdb = new TMDB($apikey, 'en', true);
echo '<h2>API Usage for TVShow examples</h2>';
// 1. Search TVShow
echo '<ol><li><a id="searchTVShow"><h3>Search TVShow</h3></a><ul>';
$tvShows = $tmdb->searchMovie("breaking bad");
foreach ($tvShows as $tvShow) {
    echo '<li>' . $tvShow->getTitle() . ' (<a href="https://www.themoviedb.org/tv/' . $tvShow->getID() . '">' . $tvShow->getID() . '</a>)</li>';
}
echo '</ul></li><hr>';
// 2. Full Movie Info
echo '<li><a id="tvShowInfo"><h3>Full TVShow Info</h3></a>';
$tvShow = $tmdb->getTVShow(1396);
echo 'Now the <b>$tvShow</b> var got all the data, check the <a href="http://code.octal.es/php/tmdb-api/class-TVShow.html">documentation</a> for the complete list of methods.<br><br>';
echo '<b>' . $tvShow->getName() . '</b><ul>';
echo '  <li>ID:' . $tvShow->getID() . '</li>';
echo '  <li>Overview: ' . $tvShow->getOverview() . '</li>';
echo '  <li>Number of Seasons: ' . $tvShow->getNumSeasons() . '</li>';
echo '  <li>Seasons: <ul>';
$seasons = $tvShow->getSeasons();
foreach ($seasons as $season) {
Exemplo n.º 5
0
                 break;
             }
         }
     }
     if (!$inArray) {
         if ($type == "show") {
             $tvShows = $tmdb->searchTVShow($title);
             foreach ($tvShows as $tvShow) {
                 if ($counter == 1) {
                     break;
                 }
                 $art = $tvShow->getPoster();
                 $counter++;
             }
         } else {
             $movies = $tmdb->searchMovie($title);
             // Returns an array of Movie objects
             foreach ($movies as $movie) {
                 if ($counter == 1) {
                     break;
                 }
                 $art = $movie->getPoster();
                 $counter++;
             }
         }
         if ($art != NULL) {
             $tempRow['art'] = $imageBaseURL . $art;
         }
         $arr[] = $tempRow;
     }
 }