$value) { if (strtolower($name) == 'accept-encoding' || strtolower($name) == 'connection') { } elseif (strtolower($name) == 'host') { array_push($curl_headers_array, $name.': '.$redirect_host); } else { array_push($curl_headers_array, $name.': '.$value); } } if (!curl_load($redirect_url.$query_string, $data, $curl_headers_array)) { header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); $_SERVER['REDIRECT_STATUS'] = 404; if (file_exists('404.html')) echo file_get_contents('404.html'); die(); } $headers_end_pos = strpos($data, "\r\n\r\n"); $data_start_pos = $headers_end_pos+4; if ($headers_end_pos === false) { $headers_end_pos = strpos($data, "\n\n"); $data_start_pos = $headers_end_pos+2; } if ($headers_end_pos !== false) { $lines = parse_lines(substr($data, 0, $headers_end_pos)); foreach ($lines as $line) { // do not pass "Transfer-Encoding: chunked" header if (stripos($line, 'Transfer-Encoding') === false) { header($line."\r\n"); } } die(substr($data, $data_start_pos)); } else { die($data); }