This class enables you to retrieve data from IMDb.com with PHP. The script is a proof of concept. It's working, but you shouldn't use it, since IMDb does not allow this method of data grabbing!
Pull request Compare This branch is 114 commits behind FabianBeiner:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cache
posters
LICENSE
README.md
imdb.class.php
imdb.example.php
imdb.gallery.php
imdb.search.php
imdb.tests.php

README.md

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.


If you want to thank me for my work and the support, feel free to do this through PayPal (use mail@fabian-beiner.de as payment destination) or just buy me a book at Amazon – thank you! :-)

Changes

5.4.1

  • Fixed title
  • Added getTrailer() and getAka() (Thanks to Seifer Almasy)

5.4.0

  • Fixed Writer, Writer as URL and Votes
  • Added getColor(), getCompany() and getCompanyAsUrl()

5.3.2

  • Fixed Director, MPAA, Country & Language

5.3.1

  • Fixed IMDB_VOTES regular expression (Thanks to hareevs)
  • Tiny cleanup.

5.3.0

  • 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

5.2.4

  • Fixed a few functions in imdb.class.php
  • Added gallery script (Thanks to xsabianus)
  • Cleaned the search script

5.2.3

  • And another fix for getCastAndCharacter(AsUrl())

5.2.2

  • Forgot a link in getCastAndCharacterAsUrl() function

5.2.1

  • Added getCastAndCharacter() and getCastAndCharacterAsUrl() (Thanks to Taha Demirhan for snippets)
  • Added imdb.search.php - a small example search form (Thanks to xsabianus)

5.2.0

  • Added series functions getSeasons() and getCreator()/getCreatorAsUrl() (Coded by mali11011)

5.1.1

  • Fixed getCastAsUrl(); (Reported by od3n)

5.1.0

  • Throws an exception if there is no posters/cache directory or cURL available
  • Some code cleanup
  • Added IMDB_LOCATION

5.0.4

  • Removed/cleaned some variable names
  • Fixed IMDB_POSTER regular expression
  • Changed IMDB_PLOT regular expression

5.0.3

  • Fixed regular expression for title

5.0.2

  • Added regular expression for original title (which I prefer instead of the localized one)

5.0.1

  • 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

5.0.0

  • Complete rewrite
  • Added caching for redirects
  • Fixed ALL regular expressions according to new IMDb layout
  • Added getBudget function
  • Added debug option

Bugs?

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.

Wishes?

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.

Usage

The usage of this script is simple. Just have a look at imdb.example.php – you will understand easily how it works.

Example output (of imdb.example.php)

Screenshot