<html>
<?php
error_reporting(E_ERROR);

foreach($_SERVER as $key => $value)
{   
    if (substr($key,0,5) == 'HTTP_')    
        $req_headers[$key] = $value;
    if (substr($key,0,13) == 'HTTP_SESSION_')
    {
        $key2 = substr($key,5);
        $cust_req_headers[$key2] = $value;
    }    
}

foreach($cust_req_headers as $key => $value)
{
    $key = strtolower($key);
    $key = str_replace('_','-',$key);
        $resp_header = $key .':'. $value;
        header($resp_header);
} 

//REQUEST HEADERS Received =========================================
print"<br><br>";
print "<table border=1>";
print "<tr bgcolor=tan><td colspan=2><b>Request Headers Received by the Server</tr>";
foreach($req_headers as $key => $value)
    echo '<tr><td>', $key, '<td>', $value, '</tr>';
print "</table>";

//Custom REQUEST HEADERS Received =========================================
print"<br>";
print "<table border=1>";
print "<tr bgcolor=tan><td  colspan=2><b>Custom Request Headers Received by the Server</th>";
foreach($cust_req_headers as $key => $value)
    echo '<tr><td>', $key, '<td>', $value, '</tr>';
print "</table>";

//RESPONSE HEADERS Sent ==============================================
print"<br>";
print "<table border=1>";
print "<tr bgcolor=tan><td  colspan=2><b>Response Headers Sent by the Server</th>";
$resp_headers = headers_list();
foreach($resp_headers as $value)
    echo '<tr><td>', $value, '</tr>';
print "</table>";

?>
</div>

<?php include "../include.php"; ?>              <!-- hyperlink to see the code -->
</body>
</html>