Skip to content

Instantly share code, notes, and snippets.

@suconghou
Last active January 11, 2016 08:56
Show Gist options
  • Save suconghou/be9992613b8a41c75004 to your computer and use it in GitHub Desktop.
Save suconghou/be9992613b8a41c75004 to your computer and use it in GitHub Desktop.
<?php
function get_http_raw()
{
$raw='';
$raw.=$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n";
foreach($_SERVER as $key => $value)
{
if(substr($key,0,5)==='HTTP_')
{
$key=substr($key,5);
$key=str_replace('_','-',$key);
$raw.= $key.': '.$value."\r\n";
}
}
$raw.="\r\n";
$raw.=file_get_contents('php://input');
return $raw;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment