Skip to content

Instantly share code, notes, and snippets.

@jakeols
Created August 13, 2014 03:04
Show Gist options
  • Save jakeols/e9a6aa1a6bd4075b3fad to your computer and use it in GitHub Desktop.
Save jakeols/e9a6aa1a6bd4075b3fad to your computer and use it in GitHub Desktop.
<?php
require 'class.sosumi.php';
# icloud credentials
$ssm = new Sosumi('EMAIL', 'PASSWORD');
# show all devices
# print_r($ssm->devices);
$device_number = 'DEVICE_NUMBER';
$location_info = $ssm->locate($device_number);
# print location info
# print_r($location_info['latitude']);
# print_r($location_info['longitude']);
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<!-- style -->
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<!-- end style -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
</script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(<?php print_r($location_info['latitude']); ?>, <?php print_r($location_info['longitude']); ?>);
var mapOptions = {
zoom: 8,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment