intitle:信息检索
![The Office (UK)](https://i-blog.csdnimg.cn/blog_migrate/c00a3af7d4cdfbba26719135a7e39a8f.png)
I'm a bigtime TV/movie buff. If it's ever seen the light of day on HBO or BBC America, I've seen it (and quite possibly filmed my own made-for-TV-short-film). Unfortunately IMDB doesn't provide an official API for movies and TV shows but thankfully TVDB does.
我是电视/电影迷。 如果曾经在HBO或BBC America上看到过这种情况,那我就已经看过(而且很可能拍摄了我自己为电视制作的短片)。 不幸的是,IMDB没有提供用于电影和电视节目的官方API,但值得庆幸的是TVDB可以提供。
Retrieving information from TVDB is a breeze using a small library called PHPTVDB written by Ryan Doherty. With a little PHP knowledge and TVDB API key, you can easily grab data about any TV show.
使用Ryan Doherty编写的名为PHPTVDB的小型库,从TVDB检索信息非常容易。 只需一点PHP知识和TVDB API密钥,您就可以轻松获取有关任何电视节目的数据。
PHP (The PHP)
/* include the library */
require 'phptvdb-1.0.2/TVDB.php';
/* get the office! */
$shows = TV_Shows::search('The Office UK');
/* get the first show */
$show = $shows[0];
/* a few shortcuts / formatted vars */
$firstAired = date('l, F j, Y',$show->firstAired);
$imdb_url = "http://imdb.com/title/$show->imdbId";
/* spit out the show information */
echo "<h2>$show->seriesName</h2>
<div class=\"meta\">
<strong>Rating:</strong> $show->rating •
<strong>Debuted:</strong> $firstAired on $show->network •
<a href=\"$imdb_url\">$show->seriesName on IMDB</a>
</div>
<p>$show->overview</p>";
/* my favorite episode info */
$episode = $show->getEpisode(1,4);
echo "<div class=\"righty\">
<h3>Favorite Episode: $episode->name</h3>
<p>$episode->overview</p>
</div>";
/* spit out the actors */
echo '<h3>The Cast</h3><ul>';
foreach($show->actors as $actor) {
echo "<li>$actor</li>";
}
echo '</ul><br />';
/* learn more link */
echo "<p><a href=\"http:/* imdb.com/title/\">Learn more about \"$imdb_url\" on IMDB</a></p>";
The above is just a sample usage of this great PHP library. You can find documentation here. Remember to try to be specific in your initial show search. I recommend going to IMDB or TVDB to get the show's "official" name to confirm you are being as specific as possible.
上面只是这个出色PHP库的示例用法。 您可以在此处找到文档 。 切记在最初的演出搜索中尽量做到具体。 我建议去IMDB或TVDB获得节目的“正式”名称,以确认您的身份尽可能具体。
intitle:信息检索