有电影放映时间的api吗? [英] Is there a movie showtime api?
本文介绍了有电影放映时间的api吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道任何(最好是免费的)支持通过邮政编码访问电影放映时间的 API?
Does anyone know of any (preferrably free) supported api's for accessing movie showtimes by zip code?
我不相信任何现有的 api,例如 netflix 或 imdb,提供此信息.
I don't believe any existing api's, such as netflix or imdb, provide this information.
推荐答案
禁用allow_url_fopen"后使用
when "allow_url_fopen" is disabled then use
<?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();
?>
这篇关于有电影放映时间的api吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文