Owntracks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
639 B

<?php
# Obtain the JSON payload from an OwnTracks app POSTed via HTTP
# and insert into database table.
header("Content-type: application/json");
$payload = file_get_contents("php://input");
$data = @json_decode($payload, true);
if ($data['_type'] == 'location') {
file_put_contents('toto', serialize($data));
$tst = $data['tst'];
$lat = $data['lat'];
$lon = $data['lon'];
$tid = $data['tid'];
# Convert timestamp to a format suitable for mysql
$dt = date('Y-m-d H:i:s', $tst);
}
$response = array();
# optionally add objects to return to the app (e.g.
# friends or cards)
print json_encode($response);
?>