-
Notifications
You must be signed in to change notification settings - Fork 1
/
gps.php
30 lines (24 loc) · 851 Bytes
/
gps.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
29
30
<?php
include('FleetManager.php');
$db_conn = new mysqli("localhost", "user", "password", "database");
$json = file_get_contents('php://input');
$data = json_decode($json);
$position = $data->position;
$device = $data->device;
$positionId = $data->position->id;
$fixTime = $data->position->fixTime;
$battery = $data->position->attributes->battery;
$ignition = $data->position->attributes->ignition;
$motion = $data->position->attributes->motion;
$latitude = $data->position->latitude;
$longitude = $data->position->longitude;
$course = $data->positon->course;
$deviceId = $data->device->id;
$uniqueId = $data->device->uniqueId;
$attributes = (object) [
'ignition' => $ignition,
'battery' => $battery,
'motion' => $motion
];
$fleetManager->recordGpsTrackingData($uniqueId, $fixTime, $latitude, $longitude, $speed, #course, $attributes);
?>