Is there an alternative method to getallheaders() if the NSAPI module is not available?

If the NSAPI module is not available, an alternative method to retrieve all headers in PHP is to use the `getallheaders()` function. This function is only available when PHP is running as an Apache module. If you are not using Apache or the NSAPI module is not available, you can manually retrieve the headers from the `$_SERVER` superglobal array.

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

$headers = get_all_headers();
print_r($headers);