The headers_list() function returns a list of sent (or pending) response headers.
This function returns an array containing headers.
headers_list()
Tip: To determine whether headers have been sent, use the headers_sent() function.
<?phpsetcookie("TestCookie","SomeValue"');header("X-Sample-Test: foo");header('Content-type: text/plain');?><html><body><? php// What headers are to be sent?var_dump(headers_list());?></body></html>
The above code will output:
array(4){[0]=> string(23) "X-Powered-By: PHP/5.1.1"[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"[2]=> string(18) "X-Sample-Test: foo"[3]=> string(24) "Content-type: text/plain"}