-
-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathweather_data.php
More file actions
24 lines (24 loc) · 735 Bytes
/
weather_data.php
File metadata and controls
24 lines (24 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include('config/config.php');
global $map, $fork;
header('Content-Type: application/json');
// init map
if (strtolower($map) === "rdm") {
$scanner = new \Scanner\RDM();
} elseif (strtolower($map) === "golbat") {
$scanner = new \Scanner\Golbat();
} elseif (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;