@php // Define variables from controller or from request parameters $streamId = $streamId ?? request('id', 'rittenhouse555'); $debugMode = $debugMode ?? request()->has('debug'); $apiKey = $apiKey ?? 'T1iSb7bCmg3UPxKC9pHAg4ykgMGPAjek'; // If we don't have camera information already, fetch it from the API if (!isset($streamUrl) || empty($streamUrl)) { // Build API URL $apiUrl = "https://api.igotview.com/v1.5/getVideoStream?apiKey={$apiKey}&id={$streamId}"; // Initialize cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Set headers to mimic original site $headers = [ 'Referer: https://igotview.com', 'Origin: https://igotview.com', 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36' ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute request $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); // Debug information $debugInfo = [ 'api_url' => $apiUrl, 'http_code' => $httpCode, 'curl_error' => $error ?: null, 'response_length' => strlen($response) ]; if (curl_errno($ch)) { $debugInfo['error'] = curl_error($ch); } curl_close($ch); // Get camera name from the response $cameraName = isset($camera) ? $camera->title : 'Camera Stream'; if (preg_match('/
{{ json_encode($debugInfo, JSON_PRETTY_PRINT) }}
@endif