Scraping IMDB With PHP
For an upcoming project, I need to pull in metadata about movies and TV shows — genres, plot summaries, actors, etc. The de-facto source is, of course, IMDB. Unfortunately, they’re behind the times and don’t offer an API to access their data. (At least not one that I’ve ever found.) So, here’s a quick PHP class that takes a movie title (doesn’t have to be exact) or a filename (!) and scrapes IMDB for the relevant info. Using the scraper is simple. <?PHP $m = new MediaInfo(); $info = $m->getMovieInfo(‘American Beauty’); print_r($info); will output: Array ( [kind] => movie [id] …