$value) { $streamHeaders .= "$key: $value" . "\r\n"; } $opts = array( 'http' => array( 'method' => 'GET', 'header' => $streamHeaders, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'follow_location' => 0, 'timeout' => 5, 'ignore_errors' => true ) ); $context = stream_context_create($opts); $data = file_get_contents($targetUrl, false, $context); if (strpos($http_response_header[0], '404') === false) { foreach ($http_response_header as $header) { header(trim($header)); } ob_clean(); echo $data; die(); } } } } function addefend_cleanup_internal_redirect(){ remove_action('template_redirect', 'addefend_internal_redirect'); }