Reading Queued Headers : header « HTML « PHP






Reading Queued Headers

 
<?
    header("Expires: Sat, 22 Dec 1979 05:30:00 GMT");
    echo "This is some text for output.<br />";

    if (!headers_sent($filename, $linenum)) {
            header("Location: www.yoursite.com");
            exit;
    } else {
            echo "Headers already sent in $filename on line $linenum.<br />";
            echo "Headers sent are:<br /> <UL>";
            $headers = headers_list( );
            foreach($headers as $header) {
               echo "<LI>$header</LI>";
            }
            echo "</UL>";
            exit;
    }
?>
  
  








Related examples in the same category

1.Changing the page type to CSV
2.Changing the page type to XML
3.Setting a Cookie Using the header() Function
4.Logged In with cookie
5.Forcing File "Save As" Downloads
6.Good and bad Location headers
7.If a User Is Not Logged in, the Login Form Is Loaded
8.Mime types
9.Using header() to Send Raw Headers
10.Setting character encoding
11.Sending an XML response
12.Sending Content Types Other Than HTML
13.Redirect header
14.Redirecting with query string variables