From: soufiane Date: Fri, 14 Nov 2025 12:05:55 +0000 (+0100) Subject: wip #7825 10:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0c354e8eea1c86c70854d5a3eee165aab1b55064;p=fluidbook-toolbox.git wip #7825 10:00 --- diff --git a/app/Jobs/AuditLink.php b/app/Jobs/AuditLink.php index cdeaf2fde..d1f301e7f 100644 --- a/app/Jobs/AuditLink.php +++ b/app/Jobs/AuditLink.php @@ -13,6 +13,7 @@ use Cubist\Util\WebVideo; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Http; class AuditLink extends Base { @@ -45,6 +46,8 @@ class AuditLink extends Base $finalurl = ''; $finalcodeurl = ''; + print_r($curlResponse['httpcode'].' '.$link['id'].PHP_EOL); + $webvideo = WebVideo::parse($link['url'], true); if($webvideo !== false) { if($webvideo['service'] === 'youtube') { diff --git a/app/Models/FluidbookAuditLink.php b/app/Models/FluidbookAuditLink.php index bbcd9b579..d7c8d34f1 100644 --- a/app/Models/FluidbookAuditLink.php +++ b/app/Models/FluidbookAuditLink.php @@ -47,14 +47,26 @@ class FluidbookAuditLink extends ToolboxModel public static function getHttpCode($url, $timeout = 30) { - $ch = curl_init($url); - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_NOBODY, true); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_HEADER, true); - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'); + $flaresolverrUrl = 'http://flaresolverr:8191/v1'; + + $payload = json_encode([ + 'cmd' => 'request.get', + 'url' => $url, + 'maxTimeout' => 60000, + ]); + + $ch = curl_init($flaresolverrUrl); + + curl_setopt_array($ch, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => true, + CURLOPT_NOBODY => true, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_TIMEOUT => $timeout, + CURLOPT_POST => true, + CURLOPT_HTTPHEADER => ['Content-Type: application/json'], + CURLOPT_POSTFIELDS => $payload, + ]); curl_exec($ch);