Example #1
0
 /**
  * Get request variables
  * @param  String $index
  * @param  Misc $default
  * @param  Array $source
  * @return Misc
  */
 public static function params($index = null, $default = null, $source = null)
 {
     // check for php://input and merge with $_REQUEST
     if (isset($_SERVER["CONTENT_TYPE"]) && stripos($_SERVER["CONTENT_TYPE"], 'application/json') !== false || isset($_SERVER["HTTP_CONTENT_TYPE"]) && stripos($_SERVER["HTTP_CONTENT_TYPE"], 'application/json') !== false) {
         if ($json = json_decode(@file_get_contents('php://input'), true)) {
             $_REQUEST = array_merge($_REQUEST, $json);
         }
     }
     $src = $source ? $source : $_REQUEST;
     return REQUEST::fetch_from_array($src, $index, $default);
 }