aboutsummaryrefslogtreecommitdiffstats
path: root/test/data/headers.php
blob: 968f13f19abc487dcc2bfa4c7a03603089ad4690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

header( "Sample-Header: Hello World" );
header( "Empty-Header: " );
header( "Sample-Header2: Hello World 2" );

$headers = array();

foreach( $_SERVER as $key => $value ) {

	$key = str_replace( "_" , "-" , substr( $key , 0 , 5 ) == "HTTP_" ? substr( $key , 5 ) : $key );
	$headers[ $key ] = $value;

}

foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
	echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
}