Dejan Levec

Your location online


If you have an iPhone and a MobileMe subscription it’s very easy to publish your location online.

Firstly you need to turn on \"Find My iPhone\" function on iPhone in Settings application and you need to make sure you have data pushed to the iPhone.

Then you need a PHP class for fetching your iPhone location through (

Code for fetching data from the server:
// Get the iPhone location from MobileMe
echo \"Fetching iPhone location…\";
$mobileMe = new Sosumi ($mobileMeUsername, $mobileMePassword);
$iphoneLocation = $mobileMe->locate();
echo \"got it.\";
echo \"iPhone location: $iphoneLocation->latitude, $iphoneLocation->longitude\";
echo \"iPhone accuracy: $iphoneLocation->accuracy\";
echo \"<br />\";
if($iphoneLocation->latitude > 0) {
echo file_get_contents(\"\".$iphoneLocation->latitude.\"&longitude=\".$iphoneLocation->longitude.\"&accuracy=\".$iphoneLocation->accuracy.\"&key=auth-key\");
// Now update Google Latitude
//echo \"Updating Google Latitude…\";
//$google->updateLatitude($iphoneLocation->latitude, $iphoneLocation->longitude,
//<span style=\"white-space: pre;\"> $iphoneLocation->accuracy);
// All done.
echo \"Done!\";



$mobileMe = new Sosumi (\"MobileMe User Name\", \"MobileMe Password\");

$iphoneLocation = $mobileMe->locate();

if($iphoneLocation->latitude > 0) {

echo \"iPhone location: $iphoneLocation->latitude, $iphoneLocation->longitude\

echo \"iPhone accuracy: $iphoneLocation->accuracy\";


echo \"Error occured while fetching iPhone location data. Please try again later.\";



When you visit this script, you should see your iPhone location. So now you can display this data on your page or use Google Maps API to show it on the map.

If you are outdoors, your location is usually shown to a few feet accurate. On the other hand, indoors the GPS signal is weak and this feature is not really usable (accuracy is about 2000 of something – it can be off for about 1000 feet).

Leave a Reply

Your email address will not be published. Required fields are marked *