Dareros Posted October 7, 2014 Share Posted October 7, 2014 (edited) Hi; I want to get the response headers using ob_get_contents ? For example using file_get_contents, it is easy by accessing the variable $http_response_header like that : <?php $content = file_get_contents($url); print_r($http_response_header); ?> But how to do that using ob_get_contents without a file_get_contents ? something like for example : <?php ob_start(); include($path_to_script_here); $string = ob_get_contents(); // Access the headers here ob_end_clean(); ?> Thank you Edited October 7, 2014 by Dareros Quote Link to comment Share on other sites More sharing options...
Frank_b Posted October 7, 2014 Share Posted October 7, 2014 http://php.net/manual/en/function.headers-list.php Quote Link to comment Share on other sites More sharing options...
Dareros Posted October 8, 2014 Author Share Posted October 8, 2014 (edited) http://php.net/manual/en/function.headers-list.php Hi, but how to get the status code and other headers information ? This is the header i get, still doesn't contain all the info why ? 0 : X-Content-Type-Options: nosniff 1 : Server: Apache 2 : X-Powered-By: 3 : P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" 4 : Content-Type: text/html; charset=utf-8 5 : Expires: Mon, 1 Jan 2001 00:00:00 GMT 6 : Last-Modified: Wed, 08 Oct 2014 15:09:06 GMT 7 : Cache-Control: post-check=0, pre-check=0 8 : Pragma: no-cache Thank you Edited October 8, 2014 by Dareros Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.