コード例 #1
0
<?php

include 'TMDb.php';
// Default English language
$tmdb = new TMDb('API-key');
// Set-up the class with your own language
$tmdb_nl = new TMDb('API-key', 'nl');
// If you want to load the TMDb-config (default FALSE)
$tmdb_load_config = new TMDb('API-key', 'en', TRUE);
// After initialize the class
// First request a token from API
$token = $tmdb->getAuthToken();
// Request valid session for that particular user from API
$session = $tmdb->getAuthSession();
//Retrieve config with initialisation of the class
$tmdb = new TMDb('API-key', 'en', TRUE);
//Retrieve (cached) config when the class is already initialised
$config = $tmdb->getConfig();
//Retrieve config when the class is already initialised from TMDb (always new request)
$config = $tmdb->getConfiguration();
//Filepath retrieved from a method (Backdrop image)
$filepath = '/eJhymb0SiOd39L3BDe7aO7iQhQx.jpg';
//Get image URL for the backdrop image in its original size
$image_url = $tmdb->getImageUrl($filepath, TMDb::IMAGE_BACKDROP, 'original');
コード例 #2
0
<?php

require_once 'functions.php';
require_once 'config.php';
require_once 'db.php';
require_once 'TMDb-PHP-API/TMDb.php';
// Default English language
$tmdb = new TMDb(TMDB_APIKEY);
$token = $_GET['request_token'];
$session = $tmdb->getAuthSession($token);
$_SESSION['tmdb_session_id'] = $session['session_id'];
logg("New session started with token:{$token} and tmdb_session_id:" . $session['session_id']);
session_write_close();
header("Location: import.php");
die;