-
Notifications
You must be signed in to change notification settings - Fork 0
/
serve.php
executable file
·37 lines (30 loc) · 743 Bytes
/
serve.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* API entrypoint.
*
* @package arcanum
* @version $Id: api.php 5823 2012-10-02 15:11:31Z avel $
*/
$initLocation = 'api';
require_once('include/init.php');
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/include/Calculator.php';
require __DIR__ . '/include/Backdoor.php';
require __DIR__ . '/include/essential.php';
$msgs = array();
if(!isset($_GET['key'])) {
fail('No key defined');
exit;
}
$key = $_GET['key'];
allowHosts($key);
header('Content-Type: application/json');
$methods = new Backdoor();
$Server = new JsonRpc\Server($methods);
$Server->setObjectsAsArrays();
$Server->receive();
function fail($msg = '') {
header("Status: 405 Method Not Allowed");
echo $msg;
exit;
}