diff --git a/app/Helper/LinkAce.php b/app/Helper/LinkAce.php index e87846a0..fb75ce98 100644 --- a/app/Helper/LinkAce.php +++ b/app/Helper/LinkAce.php @@ -2,6 +2,8 @@ namespace App\Helper; +use Illuminate\Support\Facades\Http; + /** * Class LinkAce * @@ -23,9 +25,15 @@ class LinkAce ]; // Try to get the HTML content of that URL - try { - $html = file_get_contents($url); - } catch (\Exception $e) { + $response = Http::get($url); + + if (!$response->successful()) { + return $fallback; + } + + $html = $response->body(); + + if (empty($html)) { return $fallback; } @@ -36,10 +44,6 @@ class LinkAce return $fallback; } - if (empty($html)) { - return $fallback; - } - // Parse the HTML for the title $res = preg_match("/