Last active
May 12, 2016 13:44
-
-
Save moneeb777/d5c1ce26d68273e59ae2c10184e5bdb2 to your computer and use it in GitHub Desktop.
to get POST data from AndroidLocation application
This file contains 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 | |
// overwrite current location to myCurrentLocation.json | |
$myfile = fopen("resources/myCurrentLocation.json", "w"); | |
$time = $_POST["time"]; | |
$lat = $_POST["lat"]; | |
$lng = $_POST["lng"]; | |
$arr = array('time' => $time, 'lat' => $lat, 'lng' => $lng); | |
fwrite($myfile, json_encode($arr)); | |
fwrite($myfile, "\n"); | |
fclose($myfile); | |
// append current location to historical record | |
$myfile = fopen("resources/myLocationRecord.json", "a"); | |
$arr = array('time' => $time, 'lat' => $lat, 'lng' => $lng); | |
fwrite($myfile, json_encode($arr)); | |
fwrite($myfile, "\n"); | |
fclose($myfile); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment