From 90e71380bad862296084460c2b7d825f56086893 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 14 Apr 2011 21:22:55 +0400 Subject: [PATCH] api: support passing input parameters using JSON in HTTP POST data --- api/index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/index.php b/api/index.php index 01328b9a7..cebd1c1c4 100644 --- a/api/index.php +++ b/api/index.php @@ -21,6 +21,17 @@ session_name($session_name); + $input = file_get_contents("php://input"); + + // Override $_REQUEST with JSON-encoded data if available + if ($input) { + $input = json_decode($input, true); + + if ($input) { + $_REQUEST = $input; + } + } + if ($_REQUEST["sid"]) { session_id($_REQUEST["sid"]); }