diff --git a/composer.json b/composer.json index 82ee3e6..fc1ffc6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "jleagle/omdb-imdb-api-client", - "keywords": [ + "name": "jleagle/omdb-imdb-api-client", + "keywords": [ "imdb", "omdb", "api", @@ -8,22 +8,22 @@ "helper" ], "description": "A package to retrieve movies and TV information from IMDB using the API at omdbapi.com", - "license": "MIT", - "authors": [ + "license": "MIT", + "authors": [ { - "name": "James Eagle", - "email": "jimeagle@gmail.com", + "name": "James Eagle", + "email": "jimeagle@gmail.com", "homepage": "http://jimeagle.com" } ], - "require": { - "php": ">=5.4", - "guzzlehttp/guzzle": "~5.0" + "require": { + "php": ">=5.4", + "jleagle/curl-wrapper": "~0.1" }, "require-dev": { - "phpunit/phpunit": "~4.6" + "phpunit/phpunit": "~5.0" }, - "autoload": { + "autoload": { "psr-4": { "Jleagle\\Imdb\\": "src/" } diff --git a/src/Imdb.php b/src/Imdb.php index 7b7db4b..d640018 100644 --- a/src/Imdb.php +++ b/src/Imdb.php @@ -1,7 +1,8 @@ 0; } @@ -122,17 +123,22 @@ private static function isValidId($string) * * @throws ImdbException */ - private static function _get($params) + protected static function _get($params) { $params = array_filter($params); $params['r'] = 'json'; $params['v'] = '1'; - $client = new Client(); - $response = $client - ->get('http://www.omdbapi.com/', ['query' => $params]) - ->json(); + try + { + $response = Curl::get('http://www.omdbapi.com/', $params) + ->run()->getJson(); + } + catch(CurlException $e) + { + throw new ImdbException($e->getResponse()->getErrorMessage()); + } if(isset($response['Response']) && $response['Response'] == 'False') {