PHP TVDB

Download Documentation Support

What is it?

PHPTVDB is a PHP library for accessing TV show information such as episodes, actors, showtimes and descriptions. It does this by querying TheTVDB.com.

How do I use it?

  1. Download it
  2. Unzip it
  3. Put it somewhere you'll remember
  4. Obtain an API key here: thetvdb.com (registration required, sorry! I don't control the database.)
  5. Add your API key to TVDB.php on line 15
  6. Include the file 'TVDB.php'
  7. Start using it like this:
<?php
    
include('/path/to/tvdb/TVDB.php');

    
//Returns array of TV_Show objects matching 
    //'Battlestar Galactica'
    
$tvShows TV_Shows::search("Battlestar Galactica"); 
    
    
$tvShow $tvShows[0];
    
    
//'Battlestar Galactica (2003)'
    
echo $tvShow->seriesName;
    
    
//array('Edward James Olmos', 'Grace Park')
    
print_r($tvShow->actors); 

    
//Fetch a specific episode. getEpisode($season, $episode)
    
$tvEpisode $tvShow->getEpisode(211);
    
    
//'Resurrection Ship (1)'
    
echo $tvEpisode->name
    
    
//'The Battlestars Galactica and...'  
    
echo $tvEpisode->overview
?>

Requirements:

  • PHP 5 (tested with PHP 5.2.5)

Notes:

This is a first release. Which means it might have bugs. Please e-mail me if you find a bug. I'll put up some sort of public bug tracking system soon.

Please contribute back to TheTVDB.com. You can do this by adding more show information or donating money.

Known Issues

  • Script fails when a tv episode is not found