コード例 #1
0
	<body>
		<?php 
include "../tmdb-api.php";
$apikey = "Your API Key";
$tmdb = new TMDB($apikey, 'en', true);
echo '<h2>API Usage for Persons examples</h2>';
// 1. Search Person
echo '<ol><li><a id="searchPerson"><h3>Search Person</h3></a><ul>';
$persons = $tmdb->searchPerson("Johnny");
foreach ($persons as $person) {
    echo '<li>' . $person->getName() . ' (<a href="https://www.themoviedb.org/person/' . $person->getID() . '">' . $person->getID() . '</a>)</li>';
}
echo '</ul></li><hr>';
// 2. Full Person Info
echo '<li><a id="personInfo"><h3>Full Person Info</h3></a><ul>';
$person = $tmdb->getPerson(85);
echo 'Now the <b>$person</b> var got all the data, check the <a href="http://code.octal.es/php/tmdb-api/class-Person.html">documentation</a> for the complete list of methods.<br><br>';
echo '<b>' . $person->getName() . '</b><ul>';
echo '  <li>ID: ' . $person->getID() . '</li>';
echo '  <li>Birthday: ' . $person->getBirthday() . '</li>';
echo '  <li>Popularity: ' . $person->getPopularity() . '</li>';
echo '</ul>...';
echo '<img src="' . $tmdb->getImageURL('w185') . $person->getProfile() . '"/>';
echo '</ul></li><hr>';
// 3. Get the roles
echo '<li><a id="personRoles"><h3>Person Roles</h3></a>';
echo 'Now each <b>$movieRole</b> var got all the data, check the <a href="http://code.octal.es/php/tmdb-api/class-MovieRole.html">documentation</a> for the complete list of methods.<br><br>';
$movieRoles = $person->getMovieRoles();
echo '<b>' . $person->getName() . '</b> - Roles in <b>Movies</b>: <ul>';
foreach ($movieRoles as $movieRole) {
    echo '<li>' . $movieRole->getCharacter() . ' in <a href="https://www.themoviedb.org/movie/' . $movieRole->getMovieID() . '">' . $movieRole->getMovieTitle() . '</a></li>';
コード例 #2
0
ファイル: movies.php プロジェクト: rjvegas/Movie_PHP
<?php

include 'tmdb-api.php';
$root_name = "data";
$array = array();
if (!isset($_REQUEST['id']) || TRIM($_REQUEST['id']) == '') {
    $array["opcion"] = 2;
    $array["status_message"] = "The resource you requested could not be found.";
    echo json_encode($array);
} else {
    $apikey = 'b452a69cd4b748e4c41a4109f4d91f8f';
    $tmdb = new TMDB($apikey);
    // by simply giving $apikey it sets the default lang to 'en'
    $id = $_REQUEST['id'];
    $array["opcion"] = 1;
    $persona = $tmdb->getPerson($id);
    $cast = array();
    foreach ($persona->getMovieRoles() as $movies_rol) {
        $movie = $tmdb->getMovie($movies_rol->getMovieID());
        $cast[] = array("poster_path" => $movie->getPoster(), "release_date" => $movies_rol->getMovieReleaseDate(), "original_title" => $movie->getTitle(), "character" => $movies_rol->getCharacter());
    }
    $array["cast"] = $cast;
    echo json_encode($array);
}
コード例 #3
0
ファイル: search_actor.php プロジェクト: jcbejarano/alerttest
include 'tmdb-api.php';
// Insert your api key of TMDB
$apikey = '8e6b3ea147a291f833ea1ead9195b3f2';
$language = 'es';
$tmdb = new TMDB($apikey, $language);
// by simply giving $apikey it sets the default lang to 'en'
// BUSCRA ACTOR
$name = $_POST["actor"];
$persons = $tmdb->searchPerson($name);
foreach ($persons as $person) {
    $int = (int) $person->getID();
    // 2. Full Person Info
    echo '<div id="header"><br><br><a id="personInfo"><h3>Actor Information</h3></a>';
    echo '<img src="' . $tmdb->getImageURL('w185') . $person->getProfile() . '"/>';
    $person = $tmdb->getPerson($int);
    echo '<ul><h4><b>' . $person->getName() . '</b><ul>';
    echo '  <li>ID: ' . $person->getID() . '</li>';
    echo '  <li>Birthday: ' . $person->getBirthday() . '</li>';
    echo '  <li>Popularity: ' . $person->getPopularity() . '</h4></li>';
    echo '</ul>...';
    echo '</ul></li><br><hr>';
    // 3. Get the roles
    echo '<a id="personRoles">Movies In Chronological Order</a><br>';
    $movieRoles = $person->getMovieRoles();
    echo '<b>' . $person->getName() . '</b> - <b>Movies</b>: <ul></div>';
    $roles = [];
    foreach ($movieRoles as $key => $movieRole) {
        $roles[$key]["personaje"] = $movieRole->getCharacter();
        $roles[$key]["pelicula"] = $movieRole->getMovieTitle();
        $roles[$key]["fecha"] = $movieRole->getMovieReleaseDate();
コード例 #4
0
ファイル: search.php プロジェクト: rjvegas/Movie_PHP
include 'tmdb-api.php';
$root_name = "data";
$array = array();
if (!isset($_REQUEST['query']) || TRIM($_REQUEST['query']) == '') {
    $array["opcion"] = 2;
    $array["status_message"] = "The resource you requested could not be found.";
    echo json_encode($array);
} else {
    $apikey = 'b452a69cd4b748e4c41a4109f4d91f8f';
    $tmdb = new TMDB($apikey);
    // by simply giving $apikey it sets the default lang to 'en'
    $name = $_REQUEST['query'];
    $persons = $tmdb->searchPerson($name);
    $array["opcion"] = 1;
    if (sizeof($persons) == 0) {
        $array["results"] = array();
    } else {
        foreach ($persons as $person) {
            $persona = $tmdb->getPerson($person->getID());
            $know_for = array();
            $movies = $persona->getMovieRoles();
            for ($i = 0; $i < sizeof($movies) && $i < 4; $i++) {
                $know_for[] = array("title" => $movies[$i]->getMovieTitle());
            }
            $personaje = array("name" => $persona->getName(), "id" => $persona->getID(), "known_for" => $know_for, "profile_path" => $persona->getProfile());
            $array["results"][] = $personaje;
        }
    }
    echo json_encode($array);
}
コード例 #5
0
ファイル: Person.php プロジェクト: arjint2004/12516
 /**
  *  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->getPerson($this->getID());
 }