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
711 B

9 months ago
  1. <?php
  2. # Obtain the JSON payload from an OwnTracks app POSTed via HTTP
  3. # and insert into database table.
  4. header("Content-type: application/json");
  5. $payload = file_get_contents("php://input");
  6. $data = @json_decode($payload, true);
  7. if ($data['_type'] == 'location') {
  8. file_put_contents('toto', serialize($data));
  9. $tst = $data['tst'];
  10. $lat = $data['lat'];
  11. $lon = $data['lon'];
  12. $tid = $data['tid'];
  13. # Convert timestamp to a format suitable for mysql
  14. $dt = date('Y-m-d H:i:s', $tst);
  15. }
  16. $response = array();
  17. # optionally add objects to return to the app (e.g.
  18. # friends or cards)
  19. print json_encode($response);
  20. ?>