true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_TIMEOUT => 20, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_USERAGENT => 'Skinbase Inertia Checker/1.0', CURLOPT_HEADER => true, ]); $raw = curl_exec($handle); if ($raw === false) { $error = curl_error($handle); curl_close($handle); throw new RuntimeException($error !== '' ? $error : 'Unknown cURL error'); } $status = (int) curl_getinfo($handle, CURLINFO_RESPONSE_CODE); $headerSize = (int) curl_getinfo($handle, CURLINFO_HEADER_SIZE); curl_close($handle); return [ 'status' => $status, 'body' => substr($raw, $headerSize), ]; } $context = stream_context_create([ 'http' => [ 'method' => 'GET', 'follow_location' => 1, 'max_redirects' => 5, 'timeout' => 20, 'header' => "User-Agent: Skinbase Inertia Checker/1.0\r\n", 'ignore_errors' => true, ], ]); $body = @file_get_contents($url, false, $context); if ($body === false) { $error = error_get_last(); throw new RuntimeException($error['message'] ?? 'HTTP request failed'); } $headers = $http_response_header ?? []; $status = 0; foreach ($headers as $header) { if (preg_match('~^HTTP/\S+\s+(\d{3})~', $header, $matches)) { $status = (int) $matches[1]; } } return [ 'status' => $status, 'body' => $body, ]; } function classifyHtml(string $html): string { $hasApp = str_contains($html, 'id="app"'); $hasDataPage = str_contains($html, 'data-page="'); if (! $hasApp || ! $hasDataPage) { return 'NOT_INERTIA'; } if (! preg_match('~