null, 'result' => NULL, 'error' => sprintf('unable to decode malformed json') ); } else { try { $result = @call_user_func_array(array($object,$request['method']),$request['params']); if ($result!==false) { $response = array ( 'id' => $request['id'], 'result' => $result, 'error' => NULL ); } else { $response = array ( 'id' => $request['id'], 'result' => NULL, 'error' => 'unknown method or incorrect parameters' ); } } catch (Exception $e) { $response = array ( 'id' => $request['id'], 'result' => NULL, 'error' => $e->getMessage() ); } } // output the response if (is_null($request) || !empty($request['id'])) { // notifications don't want response header('content-type: text/javascript'); BigData::json_echo($response); } // finish return true; } } ?>