Whereabouts Software, Part 2 - Fetch Locations
The server-side collection and processing is done with a PHP script on a LAMP (Linux, Apache, MySQL, PHP) server and is executed by cron. I set mine to query the phone data every 15 minutes, and it didn't seem to kill my battery any more than normal. Increase or decrease the timing as you see fit.
The script is dependent on the work of Tyler Hall and his Sosumi PHP library to get the location data from the Find my iPhone service. You will need to download the class from his website.
The script included below will query the phone data for users in the database whose 'location_source' is 'GPS'. You will need to modify the following in the script to get the location grabbing code to work:
// Enter your iCloud username and password
$ssm = new Sosumi('your_apple_id', 'your_password');
// Database connection information
$db_hostname = "your_database_host";
$db_username = "db_username";
$db_password = "db_password";
$db_database = "whereabouts";
Once this is completed, run the script with `php fetch_locations.php` and observe the output. You should see something similar to this:
CURRENT TIMESTAMPS:
Timestamp: 1381456148
Date Time: 2013-10-10 20:49:08
LAST DATA: USER1 | PHONE DATA: USER1
--------------------------------------------------------------------------------
Timestamp: 1381454227 | Timestamp: 1381455996
DateTime: 2013-10-10 20:17:07 | DateTime: 2013-10-10 20:46:36
Latitude: xx.xxxxxxxx | Latitude: xx.xxxxxxxxx
Longitude: yy.yyyyyyyy | Longitude: yy.yyyyyyyyyyy
Accuracy: zz | Accuracy: zzz
Location: home | Location: home
--------------------------------------------------------------------------------
NEW PHONE DATA! | No change. Still at: home
LAST DATA: USER2 | PHONE DATA: USER2
--------------------------------------------------------------------------------
Timestamp: 1381455883 | Timestamp: 1381455907
DateTime: 2013-10-10 20:44:43 | DateTime: 2013-10-10 20:45:07
Latitude: xx.xxxxxxxxxxx | Latitude: xx.xxxxxxxxx
Longitude: yy.yyyyyyyyyyy | Longitude: yy.yyyyyyyyy
Accuracy: yy | Accuracy: yy
Location: home | Location: home
--------------------------------------------------------------------------------
NEW PHONE DATA! | No change. Still at: home
Here's the source code: fetch_locations.php
The script is dependent on the work of Tyler Hall and his Sosumi PHP library to get the location data from the Find my iPhone service. You will need to download the class from his website.
The script included below will query the phone data for users in the database whose 'location_source' is 'GPS'. You will need to modify the following in the script to get the location grabbing code to work:
// Enter your iCloud username and password
$ssm = new Sosumi('your_apple_id', 'your_password');
// Database connection information
$db_hostname = "your_database_host";
$db_username = "db_username";
$db_password = "db_password";
$db_database = "whereabouts";
Once this is completed, run the script with `php fetch_locations.php` and observe the output. You should see something similar to this:
CURRENT TIMESTAMPS:
Timestamp: 1381456148
Date Time: 2013-10-10 20:49:08
LAST DATA: USER1 | PHONE DATA: USER1
--------------------------------------------------------------------------------
Timestamp: 1381454227 | Timestamp: 1381455996
DateTime: 2013-10-10 20:17:07 | DateTime: 2013-10-10 20:46:36
Latitude: xx.xxxxxxxx | Latitude: xx.xxxxxxxxx
Longitude: yy.yyyyyyyy | Longitude: yy.yyyyyyyyyyy
Accuracy: zz | Accuracy: zzz
Location: home | Location: home
--------------------------------------------------------------------------------
NEW PHONE DATA! | No change. Still at: home
LAST DATA: USER2 | PHONE DATA: USER2
--------------------------------------------------------------------------------
Timestamp: 1381455883 | Timestamp: 1381455907
DateTime: 2013-10-10 20:44:43 | DateTime: 2013-10-10 20:45:07
Latitude: xx.xxxxxxxxxxx | Latitude: xx.xxxxxxxxx
Longitude: yy.yyyyyyyyyyy | Longitude: yy.yyyyyyyyy
Accuracy: yy | Accuracy: yy
Location: home | Location: home
--------------------------------------------------------------------------------
NEW PHONE DATA! | No change. Still at: home
Comments
Post a Comment