blob: e6957b621c72c8f035c51b8c892ae1a2b00bbd5d [file] [log] [blame]
Javier López-Contreras6d1d72d2018-12-27 23:17:18 +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?>