$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()); } if(!empty($request['id'])){ header('content-type: text/javascript'); echo json_encode($response); } return true; } } ?>