Beispiel #1
0
 public static function processRequest()
 {
     // get our verb
     $request_method = strtolower($_SERVER['REQUEST_METHOD']);
     $return_obj = new RestRequest();
     // store the method
     $return_obj->setMethod($request_method);
     //06.08.2012 naj - parse the uri elements
     $urirequest = $_SERVER['REQUEST_URI'];
     switch ($request_method) {
         case 'get':
             //here we need to strip off only the method call that was
             //tagged at the end of the URL
             $pos = strpos($urirequest, '?');
             $requesttype = strtolower(substr($urirequest, 1, $pos - 1));
             $urirequest = substr($urirequest, $pos + 1);
             parse_str($urirequest, $data);
             break;
         case 'post':
             $pos = strpos($urirequest, '?');
             $requesttype = strtolower(substr($urirequest, 1, $pos - 1));
             $urirequest = substr($urirequest, $pos + 1);
             parse_str($urirequest, $data);
             $data['Data'] = $_POST;
             break;
     }
     //06.08.2012 naj - set the request type
     $return_obj->setRequestType($requesttype);
     //06.08.2012 naj - set the request vars
     $return_obj->setRequestVars($data);
     return $return_obj;
 }