1
0
Fork 0
mirror of https://github.com/GeoffreyFrogeye/phroxyp.git synced 2024-11-26 20:16:06 +01:00

Support for application/json

This commit is contained in:
Geoffrey Frogeye 2015-04-09 23:47:27 +02:00
parent 3c851c6e28
commit 57b3a27de3

View file

@ -20,8 +20,10 @@ class Proxy {
$headers = array();
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_' || substr($name, 0, 8) == 'CONTENT_') {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
} else if (substr($name, 0, 8) == 'CONTENT_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $name))))] = $value;
}
}
return $headers;
@ -63,6 +65,10 @@ class Proxy {
$postData = rtrim($postData, '&');
break;
case 'application/json':
$postData = file_get_contents('php://input');
break;
case 'TODO':
$postData = stripslashes($_POST['payload']);
break;