diff --git a/app/Extensions/helper/helpers.php b/app/Extensions/helper/helpers.php index 135bf6b77..f66a0ca03 100644 --- a/app/Extensions/helper/helpers.php +++ b/app/Extensions/helper/helpers.php @@ -54,40 +54,6 @@ if (! function_exists('getRawHtml')) { } } -if (! function_exists('getRawHtmlThroughCF')) { - - /** - * @param $url - * - * @return bool|mixed|string - */ - function getRawHtmlThroughCF($url) - { - $client = new Client(['cookies' => new FileCookieJar('cookies.txt'), 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246']]); - $client->getConfig('handler')->push(CloudflareMiddleware::create()); - - try { - $response = $client->get($url)->getBody()->getContents(); - $jsonResponse = json_decode($response, true, 512, JSON_THROW_ON_ERROR); - if (json_last_error() === JSON_ERROR_NONE) { - $response = $jsonResponse; - } - } catch (RequestException $e) { - if (config('app.debug') === true) { - Log::error($e->getMessage()); - } - $response = false; - } catch (\RuntimeException $e) { - if (config('app.debug') === true) { - Log::error($e->getMessage()); - } - $response = false; - } - - return $response; - } -} - if (! function_exists('makeFieldLinks')) { /** @@ -347,7 +313,7 @@ if (! function_exists('is_it_json')) { if (is_array($isIt)) { return false; } - json_decode($isIt); + json_decode($isIt, true, 512, JSON_THROW_ON_ERROR); return json_last_error() === JSON_ERROR_NONE; } diff --git a/composer.json b/composer.json index 50c647795..a3af3c393 100755 --- a/composer.json +++ b/composer.json @@ -140,7 +140,6 @@ "spatie/laravel-directory-cleanup": "^1.2", "spatie/laravel-fractal": "^5.3", "spatie/laravel-permission": "^3.0", - "tunaabutbul/cloudflare-middleware": "^1.2", "vlucas/phpdotenv": "^3.3", "voku/simple_html_dom": "^4.3", "wandersonwhcr/illuminate-romans": "^1.0", diff --git a/composer.lock b/composer.lock index efc52a3c1..e129a87b1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "46c2cfd7678ac84d327f05a623765e5f", + "content-hash": "383df6c4c5140bd8e3873605539ba2af", "packages": [ { "name": "aharen/omdbapi", @@ -8138,48 +8138,6 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "time": "2017-11-27T11:13:29+00:00" }, - { - "name": "tunaabutbul/cloudflare-middleware", - "version": "v1.2", - "source": { - "type": "git", - "url": "https://github.com/tunaabutbul/cloudflare-middleware.git", - "reference": "05a88cf070f041d501a2d8fc3c01bb66ffc63b15" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tunaabutbul/cloudflare-middleware/zipball/05a88cf070f041d501a2d8fc3c01bb66ffc63b15", - "reference": "05a88cf070f041d501a2d8fc3c01bb66ffc63b15", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "6.3.*", - "php": ">=5.6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Tuna\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Tuna Abutbul", - "email": "tuna.abutbul+github@gmail.com" - } - ], - "description": "Cloudflare Middleware For Guzzle", - "keywords": [ - "Guzzle", - "cloudflare", - "middleware" - ], - "time": "2018-02-07T09:18:26+00:00" - }, { "name": "vlucas/phpdotenv", "version": "v3.6.0",