api: support passing input parameters using JSON in HTTP POST data

This commit is contained in:
Andrew Dolgov 2011-04-14 21:22:55 +04:00
parent a0e580b0ca
commit 90e71380ba
1 changed files with 11 additions and 0 deletions

View File

@ -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"]);
}