Does anyone know of any (preferrably free) supported api's for accessing movie showtimes by zip code?
I don't believe any existing api's, such as netflix or imdb, provide this information.
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();
?>
Yep, Yahoo apparently removed their secret movie API in November 2009.
It seems everyone gets their data from TMS Data Direct: http://www.tmsdatadirect.com/
Don't know if Google exposes it as an api but this looks a lot like what you want. http://www.google.com/movies?hl=en&near=90210&dq=movie+times+90210&sa=X&oi=showtimes&ct=title&cd=1
sorry, should've searched a bit more before posting the question.
some creative searching on del.icio.us has revealed an undocumented yahoo! movies api (sample api call).
looks nice.
After looking around a little bit, I found Dapper (open.dapper.net) to be a great solution for creating this type of feed...
Here is the feed I made, which takes a movie title and a zip code as parameters. (most others available only searched by ZIP)
http://www.dapper.net/dapp-howto-use.php?dappName=GoogleMoviesbynameANDzip
took about 5 minutes to set up...
I too am looking for showtimes I can legitimately scrape and republish. Yahoo's sound like if you don't do it for commercial purposes, it's not prohibited... or maybe that's wishful thinking on my part.
You agree not to reproduce, duplicate, copy, sell, trade, resell or exploit for any commercial purposes, any portion or use of, or access to, the Yahoo! Services
Fandango seems to have RSS feeds that allow you to search for movies near you.
Not sure if it's legal to scrape the html from this, but, it's the cleanest pseudo-API I've found. http://opensocial.flixster.com/igoogle/showtimes?date=20111025&postal=23226 - just scrape the html with something like...
$('div.showtime', response).each(function() {
// ... process each showtime div
});
My guess is that your best bet on that (unless these guys have RSS feeds) would be to scrape the HTML with a language that supports regular expressions.
Mind you, that's ugly and every time they change their code, yours -could- break.
I can't find one.
You could try screen-scraping from Yahoo Movies: 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
I was also looking for a showtime API, and like you, I have not found a good API for the movie showtimes. I decided to write my own "showtime API", based on the Google Showtimes. Please check it out.
It is a simple PHP-script, but "it does what it should do":
<?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();
?>
Example: http:// code.basvd.nl/showtime_grabber_0.1/Google_showtime.php
Download simple_html_dom.php: http:// code.basvd.nl/showtime_grabber_0.1/
I know this is a bit old. I don't think there is an api for this yet but some providers do offer this service. I suggest you look at West World Media.
http://www.google.com/ig/api?movies=YOUR_ZIP_HERE
Thanks to Nick. that's the link I will be using.
来源:https://stackoverflow.com/questions/439857/is-there-a-movie-showtime-api