1
0

headers.php 424 B

123456789101112131415161718
  1. <?php
  2. header( "Sample-Header: Hello World" );
  3. header( "Empty-Header: " );
  4. header( "Sample-Header2: Hello World 2" );
  5. $headers = array();
  6. foreach( $_SERVER as $key => $value ) {
  7. $key = str_replace( "_" , "-" , substr( $key , 0 , 5 ) == "HTTP_" ? substr( $key , 5 ) : $key );
  8. $headers[ $key ] = $value;
  9. }
  10. foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
  11. echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
  12. }