xref: /dokuwiki/lib/exe/jsonrpc.php (revision f0319d45caf727273bcf114058d27225d1ae911a)
1f657e5d0SAndreas Gohr<?php
2f657e5d0SAndreas Gohr
3f657e5d0SAndreas Gohruse dokuwiki\Remote\JsonRpcServer;
4f657e5d0SAndreas Gohr
5f657e5d0SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
6f657e5d0SAndreas Gohr
7f657e5d0SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php');
8f657e5d0SAndreas Gohrsession_write_close();  //close session
9f657e5d0SAndreas Gohr
10f657e5d0SAndreas Gohrheader('Content-Type: application/json');
11f657e5d0SAndreas Gohr
12f657e5d0SAndreas Gohr$server = new JsonRpcServer();
13f657e5d0SAndreas Gohrtry {
14*6f8e03f5SAndreas Gohr    $result = $server->serve();
15f657e5d0SAndreas Gohr} catch (\Exception $e) {
16*6f8e03f5SAndreas Gohr    $result = $server->returnError($e);
17f657e5d0SAndreas Gohr}
18f657e5d0SAndreas Gohr
19cf927d07Ssplitbrainecho json_encode($result, JSON_THROW_ON_ERROR);
20