summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-04-14 21:22:55 +0400
committerAndrew Dolgov <[email protected]>2011-04-14 21:22:55 +0400
commit90e71380bad862296084460c2b7d825f56086893 (patch)
tree359369ed81ae73adae29a00d71a9dcf830e676fa /api
parenta0e580b0ca6e42362e692240cd1193907b8b230b (diff)
api: support passing input parameters using JSON in HTTP POST data
Diffstat (limited to 'api')
-rw-r--r--api/index.php11
1 files changed, 11 insertions, 0 deletions
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"]);
}