PHP IMDb.com Grabber
This class enables you to retrieve data from IMDb.com with PHP.
The script is a proof of concept. It's working pretty well, but you shouldn't use it, since IMDb does not allow this method of data grabbing! Personally, I do not use or promote this script. You’re responsible IF you’re using it.
The technique used is called “web scraping”. That means: If IMDb changes anything on their HTML, the script is going to fail.
Did you know about the available IMDb.com API? The price to use it is around $15.000. This might be fine for commercial projects, but it's impossible to afford for private/non-commercial ones.
- Fixed title
- Added getTrailer() and getAka() (Thanks to Seifer Almasy)
- Fixed Writer, Writer as URL and Votes
- Added getColor(), getCompany() and getCompanyAsUrl()
- Fixed Director, MPAA, Country & Language
- Fixed IMDB_VOTES regular expression (Thanks to hareevs)
- Tiny cleanup.
- Added ".redir"-suffix to the redirect caches
- Naming local posters is using the movie id now (instead of a cryptic md5 hash)
- Added variable to specific a string to return if movie is not found ($strNotFound)
- Removing cookie after it's not used anymore
- Some code tweaks
- Fixed a few functions in imdb.class.php
- Added gallery script (Thanks to xsabianus)
- Cleaned the search script
- And another fix for getCastAndCharacter(AsUrl())
- Forgot a link in getCastAndCharacterAsUrl() function
- Added getCastAndCharacter() and getCastAndCharacterAsUrl() (Thanks to Taha Demirhan for snippets)
- Added imdb.search.php - a small example search form (Thanks to xsabianus)
- Added series functions getSeasons() and getCreator()/getCreatorAsUrl() (Coded by mali11011)
- Fixed getCastAsUrl(); (Reported by od3n)
- Throws an exception if there is no posters/cache directory or cURL available
- Some code cleanup
- Added IMDB_LOCATION
- Removed/cleaned some variable names
- Fixed IMDB_POSTER regular expression
- Changed IMDB_PLOT regular expression
- Fixed regular expression for title
- Added regular expression for original title (which I prefer instead of the localized one)
- Renamed 'redirects' to 'cache'
- Added a simple caching mechanism. Defaults to one day (1440 minutes). Feel free to change this: new IMDB('Movie', 60) (for one hour). This speeds up everything dramatically.
- Removed /10 from rating return
- Complete rewrite
- Added caching for redirects
- Fixed ALL regular expressions according to new IMDb layout
- Added getBudget function
- Added debug option
If you run into a problem, feel free to contact me. I will help you if my time allows it. However, support is not guaranteed.
I will only answer bug report if you provide me a detailed output of the failing script – please enable debug through setting "const IMDB_DEBUG = true;" in imdb.class.php.
Well, normally I do not update or fix parts of this script anymore. I do update it, if one of the few givers asks me for an update. But it's very unlikely that I'll add new features for just "anyone". But feel free to add your wish to the project wiki.
The usage of this script is simple. Just have a look at imdb.example.php – you will understand easily how it works.