$url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 25, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_USERAGENT => 'Mozilla/5.0 (Dashboard Proxy; +https://viniciusmartini.com)', ]); $body = curl_exec($ch); $err = curl_error($ch); $http = curl_getinfo($ch, CURLINFO_HTTP_CODE); $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); curl_close($ch); if ($body === false || $http < 200 || $http >= 300) { http_response_code(502); header('Content-Type: text/plain; charset=utf-8'); echo "Proxy error. HTTP={$http}. Err={$err}"; exit; } if ($contentType) header('Content-Type: '.$contentType); else header('Content-Type: text/html; charset=utf-8'); echo $body;