From 57b3a27de3dcbbc71cce19d8aa6c0ba82d6a86e3 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Thu, 9 Apr 2015 23:47:27 +0200 Subject: [PATCH] Support for application/json --- proxy.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy.php b/proxy.php index d0de8e0..4a7976d 100755 --- a/proxy.php +++ b/proxy.php @@ -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;