有谁知道通过邮政编码访问电影放映时间的任何(最好是免费)受支持的api?
我不相信任何现有的api(例如netflix或imdb)都可以提供此信息。
有谁知道通过邮政编码访问电影放映时间的任何(最好是免费)受支持的api?
我不相信任何现有的api(例如netflix或imdb)都可以提供此信息。
Answers:
当“ allow_url_fopen”被禁用时,使用
<?php
/**
* Google Showtime grabber
*
* This file will grab the last showtimes of theatres nearby your zipcode.
* Please make the URL your own! You can also add parameters to this URL:
* &date=0|1|2|3 => today|1 day|2 days|etc..
* &start=10 gets the second page etc...
*
* Please download the latest version of simple_html_dom.php on sourceForge:
* http://sourceforge.net/projects/simplehtmldom/files/
*
* @author Bas van Dorst <info@basvandorst.nl>
* @version 0.1
* @package GoogleShowtime
*
* @modifyed by stephen byrne <gold.mine.labs@gmail.com>
* @GoldMinelabs.com
*/
require_once('simple_html_dom.php');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.google.ie/movies?near=dublin');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
$str = curl_exec($curl);
curl_close($curl);
$html = str_get_html($str);
print '<pre>';
foreach($html->find('#movie_results .theater') as $div) {
// print theater and address info
print "Theate: ".$div->find('h2 a',0)->innertext."\n";
//print "Address: ". $div->find('.info',0)->innertext."\n";
// print all the movies with showtimes
foreach($div->find('.movie') as $movie) {
print "Movie: ".$movie->find('.name a',0)->innertext.'<br />';
print "Time: ".$movie->find('.times',0)->innertext.'<br />';
}
print "\n\n";
}
// clean up memory
$html->clear();
?>
是的,雅虎显然在2009年11月删除了他们的秘密电影API。
似乎每个人都从TMS Data Direct获取数据:http://www.tmsdatadirect.com/
不知道Google是否将其公开为api,但这看起来很像您想要的。 http://www.google.com/movies?hl=zh_CN&near=90210&dq=movie+times+90210&sa=X&oi=showtimes&ct=title&cd=1
环顾了一会后,我发现Dapper(open.dapper.net)是创建此类供稿的绝佳解决方案...
这是我制作的供稿,它以电影标题和邮政编码为参数。(大多数其他功能只能通过ZIP搜索)
http://www.dapper.net/dapp-howto-use.php?dappName=GoogleMoviesbynameANDzip
大约花了5分钟来建立...
不知道从中删除html是否合法,但是,这是我发现的最干净的伪API。http://opensocial.flixster.com/igoogle/showtimes?date=20111025&postal=23226-只需使用类似...
$('div.showtime', response).each(function() {
// ... process each showtime div
});
我找不到一个。
您可以尝试从Yahoo电影中抓取屏幕:http : //movies.yahoo.com/showtimes/movie? z=60630&date=20090113&mid= 1810038822
z = zip code
date = year + month + day (as a string)
mid = movieID, which you will have to grab from Yahoo Movies
我也在寻找放映时间的API,和您一样,我还没有找到电影放映时间的良好API。我决定根据Google Showtimes编写自己的“ showtime API”。请检查一下。
这是一个简单的PHP脚本,但是“它做了它应该做的事”:
<?php
/**
* Google Showtime grabber
*
* This file will grab the last showtimes of theatres nearby your zipcode.
* Please make the URL your own! You can also add parameters to this URL:
* &date=0|1|2|3 => today|1 day|2 days|etc..
*
* Please download the latest version of simple_html_dom.php on sourceForge:
* http://sourceforge.net/projects/simplehtmldom/files/
*
* @author Bas van Dorst <info@basvandorst.nl>
* @version 0.1
* @package GoogleShowtime
*/
require_once('simple_html_dom.phps');
$html = new simple_html_dom();
$html->load_file('http://www.google.nl/movies?mid=&hl=en&near=1400AB');
print '<pre>';
foreach($html->find('#movie_results .theater') as $div) {
// print theater and address info
print "Theate: ".$div->find('h2 a',0)->innertext."\n";
print "Address: ". $div->find('.info',0)->innertext."\n";
// print all the movies with showtimes
foreach($div->find('.movie') as $movie) {
print "\tMovie: ".$movie->find('.name a',0)->innertext.'<br />';
print "\tTime: ".$movie->find('.times',0)->innertext.'<br />';
}
print "\n\n";
}
// clean up memory
$html->clear();
?>
示例:http:// code.basvd.nl/showtime_grabber_0.1/Google_showtime.php
下载simple_html_dom.php:http:// code.basvd.nl/showtime_grabber_0.1/
http://www.google.com/ig/api?movies=YOUR_ZIP_HERE
多亏尼克。这就是我将要使用的链接。