blob: 176fdfebb1e2495a1a48c17da282c44f78f3affa [file] [log] [blame]
avm999631b637612018-12-28 01:03:44 +01001<?php
2require_once("config.php");
3
4class write {
5 public static function output($json) {
6 print_r(json_encode($json));
7 exit();
8 }
9
10 public static function error($n, $msg) {
11 self::output(["error" => $n, "msg" => $msg]);
12 }
13}
14
15function get_graph() {
16 global $conf;
17 return json_decode(file_get_contents($conf["apiurl"]), true);
18}
19
20if (!isset($_GET["action"])) {
21 write::error(1, "No action provided");
22}
23
24switch ($_GET["action"]) {
25 case "getgraf":
26 $graf = file_get_contents($conf["apiurl"]);
27 echo $graf;
28 break;
29
30 default:
31 write::error(2, "Unknown action");
32}
33?>