Exemplo n.º 1
0
    <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) {
    echo '<li><a href="https://www.themoviedb.org/tv/season/' . $season->getID() . '">Season ' . $season->getSeasonNumber() . '</a></li>';
}
echo ' </ul></ul>';
echo '<img src="' . $tmdb->getImageURL('w185') . $tvShow->getPoster() . '"/><br>...<hr>';
// 3 Get Season Info
echo '<li><a id="seasonInfo"><h3>Full Season Info</h3></a>';
$season = $tmdb->getSeason($tvShow->getID(), 2);
Exemplo n.º 2
0
 /**
  *  Reload the content of this class.<br>
  *  Could be used to update or complete the information.
  *  
  *  @param TMDB $tmdb An instance of the API handler, necesary to make the API call.
  */
 public function reload($tmdb)
 {
     return $tmdb->getTVShow($this->getID());
 }