forked from PGAN-Dev/PMSF
-
Notifications
You must be signed in to change notification settings - Fork 1
/
weather_data.php
28 lines (28 loc) · 869 Bytes
/
weather_data.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
<?php
include('config/config.php');
global $map, $fork;
header('Content-Type: application/json');
// init map
if (strtolower($map) === "monocle") {
if (strtolower($fork) === "default") {
$scanner = new \Scanner\Monocle();
} elseif (strtolower($fork) === "mad") {
$scanner = new \Scanner\Monocle_MAD();
} else {
$scanner = new \Scanner\Monocle_PMSF();
}
} else if (strtolower($map) === "rocketmap") {
if (strtolower($fork) === "mad") {
$scanner = new \Scanner\RocketMap_MAD();
}
}
if (isset($_POST['cell_id'])) {
$return_weather = $scanner->get_weather_by_cell_id($_POST['cell_id']);
} else {
// $timestamp = (isset($_POST['ts']) ? $_POST['ts'] : null);
$return_weather = $scanner->get_weather();
}
$d['weather'] = $return_weather;
$d['timestamp'] = time();
$jaysson = json_encode($d);
echo $jaysson;