]> git.wh0rd.org - tt-rss.git/commitdiff
api: support passing input parameters using JSON in HTTP POST data
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Apr 2011 17:22:55 +0000 (21:22 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Apr 2011 17:22:55 +0000 (21:22 +0400)
api/index.php

index 01328b9a70f0ddafc34b3498b3c3aee261c62c0c..cebd1c1c43f6e6eb2d1dc963fcaddccb0eb9c2d4 100644 (file)
 
        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"]);
        }