tylerhall / sosumi

A MobileMe web scraper that exposes Apple's Find My iPhone service to the command line. This allows you to programmatically retrieve your phone's current location and push messages (and an optional alarm) to the remote device.

This URL has Read+Write access

tylerhall (author)
Fri Oct 16 13:15:30 -0700 2009
commit  30d89c8577d55aed9c869e0e1839f0501d2ae177
tree    f5558eb2c805744ca7a3a1a68985f7b0a4c35e15
parent  22577fc9891432e134129568a2340b903d71a07c
sosumi / example.php
100644 75 lines (67 sloc) 2.853 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?PHP
    require 'class.sosumi.php';
    
    // You'll need to enter your own Google Maps API key
    // Get one from here: http://code.google.com/apis/maps/signup.html
    $google_maps_key = '';
 
    // Enter your MobileMe username and password
    $ssm = new Sosumi('your_username', 'your_password');
    $loc = $ssm->locate();
    
    if(isset($_POST['btnSend']))
    {
        $alarm = isset($_POST['alarm']);
        $ssm->sendMessage($_POST['msg'], $alarm);
        header('Location: ' . $_SERVER['PHP_SELF']);
    }
?>
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Sosumi</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/base/base-min.css">
<style type="text/css" media="screen">
p { text-align:left; }
#map_canvas { width:640px; height:480px; border:1px solid #000; }
</style>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?PHP echo $google_maps_key; ?>&amp;sensor=false" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
function zoomFit() {
newzoom = map.getBoundsZoomLevel(bounds);
newcenter = bounds.getCenter();
map.setCenter(newcenter, newzoom);
}
 
function createMarker(point, msg) {
bounds.extend(point);
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
map.openInfoWindowHtml(point, msg);
});
zoomFit();
return marker;
}
 
if (GBrowserIsCompatible()) {
var bounds = new GLatLngBounds();
 
var map = new GMap2(document.getElementById("map_canvas"));
map.setUIToDefault();
 
var point = new GLatLng(<?PHP echo $loc->latitude; ?>, <?PHP echo $loc->longitude; ?>);
map.addOverlay(createMarker(point, "Your Location"));
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<form action="" method="post">
<p>
<label for="msg">Message:</label>
<input type="text" name="msg" value="" id="msg">
<input type="checkbox" name="alarm" value="1" id="alarm">
<label for="alarm">Alarm?</label>
<input type="submit" name="btnSend" value="Send" id="btnSend">
</p>
</form>
<div id="map_canvas"></div>
</body>
</html>