avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | class write { |
| 3 | public static function do($json) { |
| 4 | print_r(json_encode($json)); |
| 5 | exit(); |
| 6 | } |
| 7 | |
| 8 | public static function error($n, $msg) { |
| 9 | self::do(["error" => $n, "msg" => $msg]); |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | if (!isset($_GET["action"])) { |
| 14 | write::error(1, "No action provided"); |
| 15 | } |
| 16 | |
| 17 | switch ($_GET["action"]) { |
| 18 | case "getgraf": |
| 19 | $graf = file_get_contents("https://dirba.io/grafo/api.php?req=getGraph"); |
| 20 | echo $graf; |
| 21 | break; |
| 22 | |
| 23 | default: |
| 24 | write::error(2, "Unknown action"); |
| 25 | } |
| 26 | ?> |