Kilho.net
IT Ramblings

HTTP Access Information Log

For testing OpenAPI and checking whether the connection information is correct

Method, host, and POST values on connection

[PHP]

<?
$log = $_SERVER[‘REQUEST_METHOD’].’ ‘.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’].»nn»;

foreach($_SERVER as $k => $v)
{
if($k==’HTTP_HOST’) continue;
if(substr($k, 0,5)!=’HTTP_’) continue;
$log .= ‘$k: $v’.»n»;
}

$log .= «n»;

$post = array_map(‘urldecode’, explode(‘&’, file_get_contents(‘php://input’)));
foreach($post as $v)
{
$log .= «$vn»;
}

$log .= «————————————n»;

file_put_contents(‘log.txt’, $log, FILE_APPEND | LOCK_EX);
?>

[/PHP]

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *