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 { 14f657e5d0SAndreas Gohr $result = [ 15f657e5d0SAndreas Gohr 'error' => [ 16f657e5d0SAndreas Gohr 'code' => 0, 17f657e5d0SAndreas Gohr 'message' => 'success' 18f657e5d0SAndreas Gohr ], 19f657e5d0SAndreas Gohr 'data' => $server->serve(), 20f657e5d0SAndreas Gohr ]; 21f657e5d0SAndreas Gohr} catch (\Exception $e) { 22f657e5d0SAndreas Gohr $result = [ 23f657e5d0SAndreas Gohr 'error' => [ 24f657e5d0SAndreas Gohr 'code' => $e->getCode(), 25f657e5d0SAndreas Gohr 'message' => $e->getMessage() 26f657e5d0SAndreas Gohr ], 27f657e5d0SAndreas Gohr 'data' => null, 28f657e5d0SAndreas Gohr ]; 29f657e5d0SAndreas Gohr} 30f657e5d0SAndreas Gohr 31*cf927d07Ssplitbrainecho json_encode($result, JSON_THROW_ON_ERROR); 32