Last active
February 9, 2021 04:21
-
-
Save mattrude/ffbbad3deee2f943c55d822293379821 to your computer and use it in GitHub Desktop.
A helper file to transmit locations from TheThingsNetwork to Traccar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = file_get_contents('php://input'); | |
$data = json_decode($json, true); | |
$id = $data["dev_id"]; | |
$lat = $data["payload_fields"]["latitude"]; | |
$lon = $data["payload_fields"]["longitude"]; | |
$altitude = $data["payload_fields"]["altitude"]; | |
if (isset($id)) { | |
if (isset($lat)) { | |
if (isset($lon)) { | |
$page = file_get_contents("http://127.0.0.1:5055/?id=$id&lat=$lat&lon=$lon&alt=$altitude"); | |
} | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = file_get_contents('php://input'); | |
$data = json_decode($json, true); | |
$id = $data["end_device_ids"]["device_id"]; | |
$lat = $data["uplink_message"]["decoded_payload"]["latitude"]; | |
$lon = $data["uplink_message"]["decoded_payload"]["longitude"]; | |
$altitude = $data["uplink_message"]["decoded_payload"]["altitude"]; | |
if (isset($id)) { | |
if (isset($lat)) { | |
if (isset($lon)) { | |
$page = file_get_contents("http://127.0.0.1:5055/?id=$id&lat=$lat&lon=$lon&alt=$altitude"); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment