Skip to content

Commit

Permalink
Now on https - closes #96
Browse files Browse the repository at this point in the history
FabianBeiner committed Apr 17, 2018

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent e9f303f commit 14bb62f
Showing 3 changed files with 33 additions and 24 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.

## [6.0.8] - 2018-04-18
### Changed
- Switched everything to https.
- Updated `imdb.tests.php`.
- Added `getBudget()`. *Thanks, @bla0r!*

## [6.0.7] - 2017-12-25
### Changed
- Updated the title regex.
@@ -69,3 +75,6 @@ All notable changes to this project will be documented in this file.
[6.0.3]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.2...v6.0.3
[6.0.4]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.3...v6.0.4
[6.0.5]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.4...v6.0.5
[6.0.6]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.5...v6.0.6
[6.0.7]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.6...v6.0.7
[6.0.8]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.7...v6.0.8
12 changes: 6 additions & 6 deletions examples/imdb.tests.php
Original file line number Diff line number Diff line change
@@ -48,20 +48,20 @@
include_once '../imdb.class.php';

$aTests = [
'http://www.imdb.com/title/tt0033467/',
'http://www.imdb.com/title/tt5680152/reference',
'https://www.imdb.com/title/tt0033467/',
'https://www.imdb.com/title/tt5680152/reference',
'http://www.imdb.com/title/tt0460681/',
'tt1124379',
'tt0187775 ',
'http://www.imdb.com/title/tt1231587/',
'http://www.imdb.com/title/tt1392190/',
'https://www.imdb.com/title/tt1392190/',
'http://www.imdb.com/title/tt0421974/',
'http://www.imdb.com/title/tt0094618/',
'https://www.imdb.com/title/tt0094618/',
'http://www.imdb.com/title/tt0448157/',
'Matrix',
'Donner Pass',
'If only',
'http://www.imdb.com/title/tt1604113/',
'https://www.imdb.com/title/tt1604113/',
'Wyse Guys',
'http://www.imdb.com/title/tt2005268/',
'Wer ist Clark Rockefeller?',
@@ -70,7 +70,7 @@
'One Tree Hill',
'Formosa Betrayed',
'New York, I Love You',
'http://us.imdb.com/Title?0144117',
'https://us.imdb.com/Title?0144117',
'http://www.imdb.com/title/tt1022603/',
'Fabian Beiner never made a movie. Yet!'
];
36 changes: 18 additions & 18 deletions imdb.class.php
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ class IMDB
const IMDB_TITLE = '~itemprop="name">(.*)(<\/h3>|<span)~Ui';
const IMDB_TITLE_ORIG = '~</h3>(?:\s+)(.*)(?:\s+)<span class=\"titlereference-original-title-label~Ui';
const IMDB_TRAILER = '~href="videoplayer/(vi[0-9]*)"~Ui';
const IMDB_URL = '~http://(?:.*\.|.*)imdb.com/(?:t|T)itle(?:\?|/)(..\d+)~i';
const IMDB_URL = '~https?://(?:.*\.|.*)imdb.com/(?:t|T)itle(?:\?|/)(..\d+)~i';
const IMDB_USER_REVIEW = '~href="/title/[t0-9]*/reviews"[^>]*>([^<]*)\s*User~Ui';
const IMDB_VOTES = '~"ipl-rating-star__total-votes">\s*\((.*)\)\s*<~Ui';
const IMDB_WRITER = '~<div[^>]*>\s*(?:Writer|Writers)\s*:\s*<ul[^>]*>(.+)</ul>~Ui';
@@ -179,7 +179,7 @@ private function fetchUrl($sSearch)
$sId = IMDBHelper::matchRegex($sSearch, self::IMDB_ID, 1);
if (false !== $sId) {
$this->iId = preg_replace('~[\D]~', '', $sId);
$this->sUrl = 'http://www.imdb.com/title/tt' . $this->iId . '/reference';
$this->sUrl = 'https://www.imdb.com/title/tt' . $this->iId . '/reference';
$bSearch = false;
} else {
switch (strtolower($this->sSearchFor)) {
@@ -199,7 +199,7 @@ private function fetchUrl($sSearch)
$sParameters = '&s=tt';
}

$this->sUrl = 'http://www.imdb.com/find?q=' . str_replace(' ', '+', $sSearch) . $sParameters;
$this->sUrl = 'https://www.imdb.com/find?q=' . str_replace(' ', '+', $sSearch) . $sParameters;
$bSearch = true;

// Was this search already performed and cached?
@@ -249,7 +249,7 @@ private function fetchUrl($sSearch)
// Was the movie found?
$sMatch = IMDBHelper::matchRegex($sSource, self::IMDB_SEARCH, 1);
if (false !== $sMatch) {
$sUrl = 'http://www.imdb.com/title/' . $sMatch . '/reference';
$sUrl = 'https://www.imdb.com/title/' . $sMatch . '/reference';
if (true === self::IMDB_DEBUG) {
echo '<pre><b>New redirect saved:</b> ' . basename($sRedirectFile) . ' => ' . $sUrl . '</pre>';
}
@@ -516,7 +516,7 @@ public function getAkas()

return IMDBHelper::arrayOutput($this->bArrayOutput, $this->sSeparator, self::$sNotFound, $aReturn);
} else {
$fullAkas = sprintf('http://www.imdb.com/title/tt%s/releaseinfo', $this->iId);
$fullAkas = sprintf('https://www.imdb.com/title/tt%s/releaseinfo', $this->iId);
$aCurlInfo = IMDBHelper::runCurl($fullAkas);
$sSource = $aCurlInfo['contents'];

@@ -612,7 +612,7 @@ public function getCastAsUrl($iLimit = 0, $bMore = true, $sTarget = '')
break;
}
$aReturn[] =
'<a href="http://www.imdb.com/name/' .
'<a href="https://www.imdb.com/name/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -687,7 +687,7 @@ public function getCastAndCharacterAsUrl($iLimit = 0, $bMore = true, $sTarget =
break;
}
$aReturn[] =
'<a href="http://www.imdb.com/name/' .
'<a href="https://www.imdb.com/name/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -783,7 +783,7 @@ public function getCompanyAsUrl($sTarget = '')
if (true === $this->isReady) {
$aMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_COMPANY);
if (isset($aMatch[2][0])) {
return '<a href="http://www.imdb.com/company/' .
return '<a href="https://www.imdb.com/company/' .
IMDBHelper::cleanString($aMatch[1][0]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -823,7 +823,7 @@ public function getCountryAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/country/' .
'<a href="https://www.imdb.com/country/' .
trim($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -867,7 +867,7 @@ public function getCreatorAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/name/' .
'<a href="https://www.imdb.com/name/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -911,7 +911,7 @@ public function getDirectorAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/name/' .
'<a href="https://www.imdb.com/name/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -954,7 +954,7 @@ public function getGenreAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach (array_unique($aMatch[2]) as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/search/title?genres=' .
'<a href="https://www.imdb.com/search/title?genres=' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -997,7 +997,7 @@ public function getLanguageAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/language/' .
'<a href="https://www.imdb.com/language/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -1040,7 +1040,7 @@ public function getLocationAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/search/title?locations=' .
'<a href="https://www.imdb.com/search/title?locations=' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -1227,7 +1227,7 @@ public function getSeasonsAsUrl($sTarget = '')
if (count($aMatch[1])) {
foreach (range(1, max($aMatch[1])) as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/title/tt' .
'<a href="https://www.imdb.com/title/tt' .
$this->iId .
'/episodes?season=' .
$sName .
@@ -1325,7 +1325,7 @@ public function getTrailerAsUrl($bEmbed = false)
if (true === $this->isReady) {
$sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_TRAILER, 1);
if (false !== $sMatch) {
$sUrl = 'http://www.imdb.com/video/imdb/' . $sMatch . '/' . ($bEmbed ? 'player' : '');
$sUrl = 'https://www.imdb.com/video/imdb/' . $sMatch . '/' . ($bEmbed ? 'player' : '');

return IMDBHelper::cleanString($sUrl);
}
@@ -1389,7 +1389,7 @@ public function getWriterAsUrl($sTarget = '')
if (count($aMatch[2])) {
foreach ($aMatch[2] as $i => $sName) {
$aReturn[] =
'<a href="http://www.imdb.com/name/' .
'<a href="https://www.imdb.com/name/' .
IMDBHelper::cleanString($aMatch[1][$i]) .
'/"' .
($sTarget ? ' target="' . $sTarget . '"' : '') .
@@ -1617,7 +1617,7 @@ public static function runCurl($sUrl, $bDownload = false)
'Accept-Charset: utf-8, iso-8859-1;q=0.5',
'Accept-Language: ' . self::IMDB_LANG
],
CURLOPT_REFERER => 'http://www.imdb.com',
CURLOPT_REFERER => 'https://www.imdb.com',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,

0 comments on commit 14bb62f

Please sign in to comment.