Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: abhinayrathore/PHP-IMDb-Scraper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: dhobi/PHP-IMDb-Scraper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Sep 26, 2016

  1. Fixed poster scraping

    Daniel Hobi committed Sep 26, 2016
    Copy the full SHA
    1085ff3 View commit details
  2. Added simple form

    Daniel Hobi committed Sep 26, 2016
    Copy the full SHA
    f256992 View commit details
  3. Update Readme

    Daniel Hobi committed Sep 26, 2016
    Copy the full SHA
    f93dc3d View commit details

Commits on Dec 20, 2017

  1. Url has changed from /combined to /reference

    Daniel Hobi committed Dec 20, 2017
    Copy the full SHA
    cdb307f View commit details

Commits on Dec 23, 2017

  1. Added gitignore (idea)

    docker compose for testing
    dhobi committed Dec 23, 2017
    Copy the full SHA
    9fa5206 View commit details
  2. PHP-IMDb-Scraper Error #1

    - Fixes the regexes for the listed non-working attributes
    dhobi committed Dec 23, 2017
    Copy the full SHA
    e1e55dd View commit details
  3. #2: fix regex for votes

    dhobi committed Dec 23, 2017
    Copy the full SHA
    03e7b79 View commit details

Commits on Dec 24, 2017

  1. #3: fix poster

    - seems like imdb just changed this yesterday
    dhobi committed Dec 24, 2017
    Copy the full SHA
    7801001 View commit details
  2. fixing tagline + plot

    dhobi committed Dec 24, 2017
    Copy the full SHA
    36bda65 View commit details
  3. Copy the full SHA
    695fea8 View commit details
  4. Copy the full SHA
    02a7c55 View commit details

Commits on Dec 26, 2017

  1. #4 stars movies character name showing

    - parsing own stars section
    dhobi committed Dec 26, 2017
    Copy the full SHA
    8054bb4 View commit details
  2. #5 Not directors in data!

    directors, writers, producers, musicians, cinematographers and editors
    dhobi committed Dec 26, 2017
    Copy the full SHA
    659b162 View commit details

Commits on Dec 27, 2017

  1. Missing person id #9

    - reverted to match key value
    dhobi committed Dec 27, 2017
    Copy the full SHA
    d71fcc2 View commit details
  2. Copy the full SHA
    5fade66 View commit details
  3. For @AndreiTelteu

    -> scrape by giving a complete imdb url
    dhobi committed Dec 27, 2017
    Copy the full SHA
    f631eef View commit details

Commits on Dec 28, 2017

  1. #10 Cast, Character to Real Name

    - fixing country, language and videos
    dhobi committed Dec 28, 2017
    Copy the full SHA
    91e2b8f View commit details

Commits on Jan 4, 2018

  1. #11 Actor list instead producers list

    - more specific section selector (h4 in front)
    dhobi committed Jan 4, 2018
    Copy the full SHA
    7312d39 View commit details

Commits on Mar 19, 2018

  1. #13 - imdb change image link

    -> changed from amazon ia.media-imdb.com (dns)
    dhobi committed Mar 19, 2018
    Copy the full SHA
    72520b0 View commit details

Commits on Apr 17, 2018

  1. #14 Not Working From Today

    Changed imdb url to https (redirect response in case of http)
    dhobi authored Apr 17, 2018
    Copy the full SHA
    f82dd41 View commit details

Commits on Apr 18, 2018

  1. Copy the full SHA
    f7a1ab3 View commit details

Commits on Jun 5, 2018

  1. #16 - No poster url is fetched

    -> changed from amazon ia.media-imdb.com to m.media-amazon.com
    dhobi committed Jun 5, 2018
    Copy the full SHA
    aec00bd View commit details

Commits on Dec 10, 2019

  1. Title is showing original title #19

    Daniel Hobi committed Dec 10, 2019
    Copy the full SHA
    c0a7a2c View commit details
Showing with 246 additions and 42 deletions.
  1. +1 −0 .gitignore
  2. +13 −1 README.md
  3. +19 −0 docker-compose.yml
  4. +61 −41 imdb.php
  5. +152 −0 index.php
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
PHP-IMDb-Scraper
================

Demo: http://lab.abhinayrathore.com/imdb/
## About
This is a fork from [abhinayrathore/PHP-IMDb-Scraper](https://github.com/abhinayrathore/PHP-IMDb-Scraper)

## Changelog
- 2017-12-20: Fix new IMDB combined url (is / reference now)
- 2016-09-26: Added (another) demo site
- 2016-09-26: Added simple form (index.php)
- 2016-09-26: Fixed poster scraping

## Demo
This fork: https://www.danielhobi.ch/imdb/

Original: http://lab.abhinayrathore.com/imdb/
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'
services:
web:
environment:
- ENVIRONMENT=docker
- PHP_DEBUGGER=xdebug
- XDEBUG_REMOTE_PORT=9000
- XDEBUG_REMOTE_AUTOSTART=0
- XDEBUG_REMOTE_CONNECT_BACK=0
- php.memory_limit=64M
- FPM_PM_MAX_CHILDREN=8
- FPM_PM_START_SERVERS=8
- FPM_PM_MIN_SPARE_SERVERS=7
- FPM_PM_MAX_SPARE_SERVERS=8
image: webdevops/php-nginx-dev:7.1
ports:
- "80:80"
volumes:
- ".:/app"
102 changes: 61 additions & 41 deletions imdb.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -24,70 +24,82 @@ public function getMovieInfo($title, $getExtraInfo = true)
}
return $this->getMovieInfoById($imdbId, $getExtraInfo);
}


// Get movie information by IMDb url.
public function getMovieInfoByURL($url, $getExtraInfo = true)
{
$cleanedUrl = preg_replace('/(\?.*)/ms','', $url);
if(!$this->endsWith($cleanedUrl, '/')) {
$cleanedUrl .= '/';
}
return $this->scrapeMovieInfo($cleanedUrl, $getExtraInfo);
}

// Get movie information by IMDb Id.
public function getMovieInfoById($imdbId, $getExtraInfo = true)
{
$arr = array();
$imdbUrl = "http://www.imdb.com/title/" . trim($imdbId) . "/";
$imdbUrl = "https://www.imdb.com/title/" . trim($imdbId) . "/";
return $this->scrapeMovieInfo($imdbUrl, $getExtraInfo);
}

// Scrape movie information from IMDb page and return results in an array.
private function scrapeMovieInfo($imdbUrl, $getExtraInfo = true)
{
{ $nameExtractor = '/<a.*?href="\/name\/(.*?)["|\/].*?>(.*?)<\/a>/ms';
$arr = array();
$html = $this->geturl("${imdbUrl}combined");
$title_id = $this->match('/<link rel="canonical" href="http:\/\/www.imdb.com\/title\/(tt\d+)\/combined" \/>/ms', $html, 1);
$html = $this->geturl("${imdbUrl}reference");
$title_id = $this->match('/<link rel="canonical" href="https?:\/\/www.imdb.com\/title\/(tt\d+)\/reference" \/>/ms', $html, 1);
if(empty($title_id) || !preg_match("/tt\d+/i", $title_id)) {
$arr['error'] = "No Title found on IMDb!";
return $arr;
}
$arr['title_id'] = $title_id;
$arr['imdb_url'] = $imdbUrl;
$arr['title'] = str_replace('"', '', trim($this->match('/<title>(IMDb \- )*(.*?) \(.*?<\/title>/ms', $html, 2)));
$arr['original_title'] = trim($this->match('/class="title-extra">(.*?)</ms', $html, 1));
$arr['title'] = trim($this->match('/<meta name="title" content="(.*?)\(/ms', $html, 1));
$arr['original_title'] = trim($this->match('/<meta property=\'og:title\' content="(.*?)\(/ms', $html, 1));
$arr['year'] = trim($this->match('/<title>.*?\(.*?(\d{4}).*?\).*?<\/title>/ms', $html, 1));
$arr['rating'] = $this->match('/<b>(\d.\d)\/10<\/b>/ms', $html, 1);
$arr['genres'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Genre.?:(.*?)(<\/div>|See more)/ms', $html, 1), 1);
$arr['directors'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Directed by<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['writers'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Writing credits<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['cast'] = $this->match_all_key_value('/<td class="nm"><a.*?href="\/name\/(.*?)\/".*?>(.*?)<\/a>/ms', $this->match('/<h3>Cast<\/h3>(.*?)<\/table>/ms', $html, 1));
$arr['rating'] = $this->match('/<\/svg>.*?<\/span>.*?<span class="ipl-rating-star__rating">(.*?)<\/span>/ms', $html, 1);
$arr['genres'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Genres<\/td>.*?<td>(.*?)<\/td>/ms', $html, 1), 1);
$arr['directors'] = $this->match_all_key_value($nameExtractor, $this->match('/<h4 name="directors" id="directors" class="ipl-header__content ipl-list-title">.*?Directed by.*?<table(.*?)<\/table>/ms', $html, 1));
$arr['writers'] = $this->match_all_key_value($nameExtractor, $this->match('/Writers:.*?<ul(.*?)<\/ul>/ms', $html, 1));
$arr['cast'] = $this->match_all_key_value('/itemprop="name">(.*?)<.*?<td class="character">.*?<div>(.*?)<\/div>/ms', $this->match('/<table class="cast_list">(.*?)<\/table>/ms', $html, 1));
$arr['cast'] = array_slice($arr['cast'], 0, 30);
$arr['stars'] = array_slice($arr['cast'], 0, 5);
$arr['producers'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Produced by<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['musicians'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Original Music by<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['cinematographers'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Cinematography by<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['editors'] = $this->match_all_key_value('/<td valign="top"><a.*?href="\/name\/(.*?)\/">(.*?)<\/a>/ms', $this->match('/Film Editing by<\/a><\/h5>(.*?)<\/table>/ms', $html, 1));
$arr['mpaa_rating'] = $this->match('/MPAA<\/a>:<\/h5><div class="info-content">Rated (G|PG|PG-13|PG-14|R|NC-17|X) /ms', $html, 1);
$arr['release_date'] = $this->match('/Release Date:<\/h5>.*?<div class="info-content">.*?([0-9][0-9]? (January|February|March|April|May|June|July|August|September|October|November|December) (19|20)[0-9][0-9])/ms', $html, 1);
$arr['tagline'] = trim(strip_tags($this->match('/Tagline:<\/h5>.*?<div class="info-content">(.*?)(<a|<\/div)/ms', $html, 1)));
$arr['plot'] = trim(strip_tags($this->match('/Plot:<\/h5>.*?<div class="info-content">(.*?)(<a|<\/div|\|)/ms', $html, 1)));
$arr['plot_keywords'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Plot Keywords:<\/h5>.*?<div class="info-content">(.*?)<\/div/ms', $html, 1), 1);
$arr['poster'] = $this->match('/<a name="poster".*?><img.*?id="primary-poster".*?src="(.*?)"/ms', $html, 1);
$arr['stars'] = $this->match_all_key_value($nameExtractor, $this->match('/Stars:(.*?)<\/ul>/ms', $html, 1));
$arr['producers'] = $this->match_all_key_value($nameExtractor, $this->match('/<h4 name="producers" id="producers" class="ipl-header__content ipl-list-title">.*?Produced by.*?<table(.*?)<\/table>/ms', $html, 1));
$arr['musicians'] = $this->match_all_key_value($nameExtractor, $this->match('/Music by.*?<table(.*?)<\/table>/ms', $html, 1));
$arr['cinematographers'] = $this->match_all_key_value($nameExtractor, $this->match('/Cinematography by.*?<table(.*?)<\/table>/ms', $html, 1));
$arr['editors'] = $this->match_all_key_value($nameExtractor, $this->match('/Film Editing by.*?<table(.*?)<\/table>/ms', $html, 1));
$arr['mpaa_rating'] = $this->match('/<a href="\/preferences\/general" class=>Change View<\/a>.*?<\/span>.*?<hr>.*?<ul class="ipl-inline-list">.*?<li class="ipl-inline-list__item">.*?(G|PG-13|PG-14|PG|R|NC-17|X).*?<\/li>/ms', $html, 1);
$arr['release_date'] = $this->match('/releaseinfo">([0-9][0-9]? ([a-zA-Z]*) (19|20)[0-9][0-9])/ms', $html, 1);
$arr['tagline'] = trim(strip_tags($this->match('/Taglines<\/td>.*?<td>(.*?)</ms', $html, 1)));
$arr['plot'] = trim(strip_tags($this->match('/Plot Summary<\/td>.*?<td>.*?<p>(.*?)</ms', $html, 1)));
$arr['plot_keywords'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Plot Keywords<\/td>.*?<td>.*?<ul class="ipl-inline-list">(.*?)<\/ul>/ms', $html, 1), 1);
$arr['poster'] = $this->match('/class="titlereference-primary-image".*?src="(.*?)".*? \/>/ms', $html, 1);
$arr['poster_large'] = "";
$arr['poster_full'] = "";
if ($arr['poster'] != '' && strpos($arr['poster'], "amazon.com") > 0) { //Get large and small posters
if ($arr['poster'] != '' && strpos($arr['poster'], "m.media-amazon.com") > 0) { //Get large and small posters
$arr['poster'] = preg_replace('/_V1.*?.jpg/ms', "_V1._SY200.jpg", $arr['poster']);
$arr['poster_large'] = preg_replace('/_V1.*?.jpg/ms', "_V1._SY500.jpg", $arr['poster']);
$arr['poster_full'] = preg_replace('/_V1.*?.jpg/ms', "_V1._SY0.jpg", $arr['poster']);
} else {
$arr['poster'] = "";
}
$arr['runtime'] = trim($this->match('/Runtime:<\/h5><div class="info-content">.*?(\d+) min.*?<\/div>/ms', $html, 1));
$arr['runtime'] = trim($this->match('/Runtime<\/td>.*?(\d+) min.*?<\/li>/ms', $html, 1));
$arr['top_250'] = trim($this->match('/Top 250: #(\d+)</ms', $html, 1));
$arr['oscars'] = trim($this->match('/Won (\d+) Oscars?\./ms', $html, 1));
if(empty($arr['oscars']) && preg_match("/Won Oscar\./i", $html)) $arr['oscars'] = "1";
$arr['awards'] = trim($this->match('/(\d+) wins/ms',$html, 1));
$arr['nominations'] = trim($this->match('/(\d+) nominations/ms',$html, 1));
$arr['votes'] = $this->match('/>([0-9,]*) votes</ms', $html, 1);
$arr['language'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Language.?:(.*?)(<\/div>|>.?and )/ms', $html, 1), 1);
$arr['country'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Country:(.*?)(<\/div>|>.?and )/ms', $html, 1), 1);
$arr['votes'] = $this->match('/<span class="ipl-rating-star__total-votes">\((.*?)\)<\/span>/ms', $html, 1);
$arr['language'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Language<\/td>(.*?)<\/td>/ms', $html, 1), 1);
$arr['country'] = $this->match_all('/<a.*?>(.*?)<\/a>/ms', $this->match('/Country<\/td>(.*?)<\/td>/ms', $html, 1), 1);

if($getExtraInfo == true) {
$plotPageHtml = $this->geturl("${imdbUrl}plotsummary");
$arr['storyline'] = trim(strip_tags($this->match('/<li class="odd">.*?<p>(.*?)(<|<\/p>)/ms', $plotPageHtml, 1)));
$releaseinfoHtml = $this->geturl("http://www.imdb.com/title/" . $arr['title_id'] . "/releaseinfo");
$arr['storyline'] = trim(strip_tags($this->match('/id="summary.*?">.*?<p>(.*?)(<|<\/p>)/ms', $plotPageHtml, 1)));
if(empty($arr['plot'])) {
$arr['plot'] = $arr['storyline'];
}
$releaseinfoHtml = $this->geturl("https://www.imdb.com/title/" . $arr['title_id'] . "/releaseinfo");
$arr['also_known_as'] = $this->getAkaTitles($releaseinfoHtml);
$arr['release_dates'] = $this->getReleaseDates($releaseinfoHtml);
$arr['recommended_titles'] = $this->getRecommendedTitles($arr['title_id']);
@@ -123,7 +135,7 @@ private function getAkaTitles($html){

// Collect all Media Images.
private function getMediaImages($titleId){
$url = "http://www.imdb.com/title/" . $titleId . "/mediaindex";
$url = "https://www.imdb.com/title/" . $titleId . "/mediaindex";
$html = $this->geturl($url);
$media = array();
$media = array_merge($media, $this->scanMediaImages($html));
@@ -145,7 +157,7 @@ private function scanMediaImages($html){

// Get recommended titles by IMDb title id.
public function getRecommendedTitles($titleId){
$json = $this->geturl("http://www.imdb.com/widget/recommendations/_ajax/get_more_recs?specs=p13nsims%3A${titleId}");
$json = $this->geturl("https://www.imdb.com/widget/recommendations/_ajax/get_more_recs?specs=p13nsims%3A${titleId}");
$resp = json_decode($json, true);
$arr = array();
if(isset($resp["recommendations"])) {
@@ -159,17 +171,17 @@ public function getRecommendedTitles($titleId){

// Get all Videos and Trailers
public function getVideos($titleId){
$html = $this->geturl("http://www.imdb.com/title/${titleId}/videogallery");
$html = $this->geturl("https://www.imdb.com/title/${titleId}/videogallery");
$videos = array();
foreach ($this->match_all('/<a.*?href="\/videoplayer\/(vi\d+).*?".*?>.*?<\/a>/ms', $html, 1) as $v) {
$videos[] = "http://www.imdb.com/video/imdb/${v}";
foreach ($this->match_all('/<a.*?href="(\/videoplayer\/vi\d*?)".*?>.*?<\/a>/ms', $html, 1) as $v) {
$videos[] = "https://www.imdb.com${v}";
}
return array_filter($videos);
}

// Get Top 250 Movie List
public function getTop250(){
$html = $this->geturl("http://www.imdb.com/chart/top");
$html = $this->geturl("https://www.imdb.com/chart/top");
$top250 = array();
$rank = 1;
foreach ($this->match_all('/<tr class="(even|odd)">(.*?)<\/tr>/ms', $html, 2) as $m) {
@@ -179,7 +191,7 @@ public function getTop250(){
$rating = $this->match('/<td class="ratingColumn"><strong.*?>(.*?)<\/strong>/msi', $m, 1);
$poster = $this->match('/<td class="posterColumn">.*?<img src="(.*?)"/msi', $m, 1);
$poster = preg_replace('/_V1.*?.jpg/ms', "_V1._SY200.jpg", $poster);
$url = "http://www.imdb.com/title/${id}/";
$url = "https://www.imdb.com/title/${id}/";
$top250[] = array("id"=>$id, "rank"=>$rank, "title"=>$title, "year"=>$year, "rating"=>$rating, "poster"=>$poster, "url"=>$url);
$rank++;
}
@@ -197,8 +209,8 @@ private function getIMDbIdFromSearch($title, $engine = "google"){
case FALSE: return NULL;
default: return NULL;
}
$url = "http://www.${engine}.com/search?q=imdb+" . rawurlencode($title);
$ids = $this->match_all('/<a.*?href="http:\/\/www.imdb.com\/title\/(tt\d+).*?".*?>.*?<\/a>/ms', $this->geturl($url), 1);
$url = "https://www.${engine}.com/search?q=imdb+" . rawurlencode($title);
$ids = $this->match_all('/<a.*?href="https?:\/\/www.imdb.com\/title\/(tt\d+).*?".*?>.*?<\/a>/ms', $this->geturl($url), 1);
if (!isset($ids[0]) || empty($ids[0])) //if search failed
return $this->getIMDbIdFromSearch($title, $nextEngine); //move to next search engine
else
@@ -222,7 +234,7 @@ private function match_all_key_value($regex, $str, $keyIndex = 1, $valueIndex =
$arr = array();
preg_match_all($regex, $str, $matches, PREG_SET_ORDER);
foreach($matches as $m){
$arr[$m[$keyIndex]] = $m[$valueIndex];
$arr[$m[$keyIndex]] = trim($m[$valueIndex]);
}
return $arr;
}
@@ -240,5 +252,13 @@ private function match($regex, $str, $i = 0){
else
return false;
}

private function endsWith($haystack, $needle)
{
$length = strlen($needle);

return $length === 0 ||
(substr($haystack, -$length) === $needle);
}
}
?>
152 changes: 152 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?php
require_once("imdb.php");


if(isset($_GET["moviename"]) | isset($_GET["movieid"])) {
$movieName = $_GET["moviename"];
$movieId = $_GET["movieid"];
$movieUrl = $_GET["movieurl"];
$output = strtolower($_GET["output"]);

$i = new Imdb();
$mArr = [];
if($movieId !== '') {
$mArr = array_change_key_case($i->getMovieInfoById($movieId), CASE_UPPER);
} else if($movieName !== '') {
$mArr = array_change_key_case($i->getMovieInfo($movieName), CASE_UPPER);
} else if($movieUrl !== '') {
$mArr = array_change_key_case($i->getMovieInfoByURL($movieUrl), CASE_UPPER);
} else {
echo 'Please give either a moviename or movieid';
}

///////////////[ XML Output ]/////////////////
if($output == "xml") {
header("Content-Type: text/xml");
$doc = new DomDocument('1.0');
$doc->formatOutput = true;
$movie = $doc->createElement('MOVIE');
$movie = $doc->appendChild($movie);
foreach ($mArr as $k=>$v){
if(is_array($v)){
$node = $doc->createElement($k);
$node = $movie->appendChild($node);
$c = 0;
foreach($v as $a){
$c++;
$child = $doc->createElement($k . "_");
$child = $node->appendChild($child);
$child->setAttribute('n', $c);
$value = $doc->createTextNode($a);
$value = $child->appendChild($value);
}
} else {
$node = $doc->createElement($k);
$node = $movie->appendChild($node);
$value = $doc->createTextNode($v);
$value = $node->appendChild($value);
}
}
$xml_string = $doc->saveXML();
echo $xml_string;
} else if($output == "json") {
header('Content-type: application/json');
echo json_encode($mArr);
} else {
echo 'Please choose an output format (xml/json)';
}
//Output html
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP-IMDb-Scraper</title>
<style>
html, body {
width:100%;
height:100%;
margin: 0;
padding:0;
font-family: Arial, serif;
font-size:13px;
background: -moz-linear-gradient(top, rgba(188,188,188,1) 0%, rgba(255,255,255,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(188,188,188,1) 0%,rgba(255,255,255,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(188,188,188,1) 0%,rgba(255,255,255,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bcbcbc', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
#imdbform {
width:500px;
margin:auto;
display:flex;
height:100%;
align-items:center;
justify-content:center;
}
.formline {
padding:5px;
}
.formline>label {
display:inline-block;
width: 150px;
color: #989898;
}
.formline>input {
border: 1px solid #ccc;
width:200px;
font-size: inherit;
padding: 5px;
}

.formline>select {
width:210px;
border: 1px solid #cccccc;
background-color: #fff;
height:30px;
}
.formline>button {
border: 1px solid #cccccc;
width: 100%;
height: 30px;
background-color: #fff;
color: #000;
}
.formline>input:hover, .formline>button:hover,.formline>select:hover {
border: 1px solid #aaa;
}
</style>
</head>

<body>
<div id="imdbform">
<form action="" method="get">
<div class="formline">
<label for="movieid">Either IMDB ID:</label>
<input type="text" placeholder="i.e. tt0848228" name="movieid" id="movieid"/>
</div>
<div class="formline">
<label for="moviename">Or Movie Name:</label>
<input type="text" placeholder="i.e. The Avengers" name="moviename" id="moviename"/>
</div>
<div class="formline">
<label for="movieurl">Or Movie URL:</label>
<input type="text" placeholder="i.e. http://www.imdb.com/title/tt0848228/" name="movieurl" id="movieurl"/>
</div>
<div class="formline">
<label for="output">Output format:</label>
<select id="output" name="output">
<option value="json">JSON</option>
<option value="xml">XML</option>
</select>
</div>
<div class="formline">
<button type="submit" id="submit">Scrape!</button>
</div>
</form>
</div>
</body>

</html>
<?php
}
?>