Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

pht get header from request

<?php
function getRequestHeaders() {
    $headers = array();
    foreach($_SERVER as $key => $value) {
        if (substr($key, 0, 5) <> 'HTTP_') {
            continue;
        }
        $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
        $headers[$header] = $value;
    }
    return $headers;
}

$headers = getRequestHeaders();

foreach ($headers as $header => $value) {
    echo "$header: $value <br />
";
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pht #header #request
ADD COMMENT
Topic
Name
2+3 =