Using Google Latitude API w/ Google Maps
Posted on Fri 28th May 2010 · Development · 3 Comments
Google, Google, Google eh! I've known about Google Latitude for a while now, I've been signed up for ages, just never used it!
I decided to take a look the other day and found it pretty nice how it does passive "check-ins", thats more my style, none of this fourwalla rubbish!
Heres an easy way to plot your current location on Google Maps :]
Live demo is located here :o
<?php
## QUERY STRING
$latitude = json_decode(file_get_contents('http://www.google.com/latitude/apps/badge/api?user=<-- USER ID -->&type=json'));
## CURRENT LOCATION
echo $latitude->features[0]->properties->reverseGeocode;
## TIME AT LOCATION
echo $latitude->features[0]->properties->timeStamp;
## IMAGE URL :]
echo $latitude->features[0]->properties->placardUrl;
?>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=<-- API KEY -->" type="text/javascript"></script>
<script type="text/javascript" src="http://paulor.net/inc/uploads/5552mapit.js"></script>
<script type="text/javascript">
window.onload = function(){
var mymap = new MeOnTheMap({
container: "map",
html: "<span id=\"location\"><?php echo $latitude->features[0]->properties->reverseGeocode; ?></span><br /><br /><img src=\"<?php echo $latitude->features[0]->properties->placardUrl; ?>\"/>",
address: "<?php echo $latitude->features[0]->properties->reverseGeocode; ?>",
zoomLevel: 13
});
mymap.adjustMapCenter({
x: 0,
y: -80
});
}
</script>
<style>
.map {
width: 710px;
height: 300px;
overflow: hidden;
}
#location {
display: block;
background-color: #111111;
color: #ffffff;
}
</style>
<div id="map" class="map"></div>
You will first of all ofcourse have to go sign up to Google Latitude aswell as get yourself a nice API Key from Google Maps for your domain name. Once this is done, fill in your User ID in the JSON query string and the API Key in the Google Maps javascript call.
Take a look at it in action!
Posted on Thu 27th May 2010 · rand() · 3 Comments
I was to busy failing with Magento at work today to do a blog post, and I forgot to pre-write one just incase. So heres Ascii art of a dino!
O_
/ >
- > ^\
/ > ^ /
(O) > ^ / / / /
_____ | \\|//
/ __ \ _/ / / _/
/ / | | / / / /
_/ |___/ / _/ ------_/ /
==_| \____/ _/ / ______/
\ \ __/ |\
| \_ ____/ / \ _
\ \________/ |\ \----/_V
\_ / \_______ V
\__ / \ / V
\ \ \
\______ \_ \
\__________\_ \
/ / \_ |
| _/ \ |
/ _/ \ |
| / | |
\ \__ | \__
/\____=\ /\_____=\
Posted on Wed 26th May 2010 · Development · 10 Comments
Sending text messages from your web site can be great for security, It would be nice to beable to make a return on it aswell, so your not forking out hundreds of pounds on text messaging, but thats up to you to manage.
ClickATell offer an amazingly simple set of APIs for sending text messages via their network, along with very affordable text messaging bundles.
The thing I use text messaging for is again, server monitoring. Whenever a server of mine goes above a certain load level, a text message is fired off to me to alert me. This actually saved the day - on Christmas day - last year, when there was a hard drive failure on a clients server, I got a text at the breakfast table.
<?php
## DEFINE ACCOUNT USERNAME & PASSWORD
$user = '<-- username -->';
$password = '<-- password -->';
## DEFINE ACCOUNTS API ID
$api_id = '<-- api id -->';
## BASE URL
$baseurl ='http://api.clickatell.com';
## MESSAGE TO BE SENT
$text = urlencode('<-- message to be sent by text -->');
## PHONE NUMBER TO SEND TO, STARTING WITH COUNTRY CODE (4477425235235)
$to = '<-- recipients phone number, starting with country code -->';
$url = $baseurl.'/http/auth?user='.$user.'&password='.$password.'&api_id='.$api_id;
$ret = file($url);
$sess = split(':',$ret[0]);
if($sess[0] == 'OK') {
$sess_id = trim($sess[1]);
$url = $baseurl.'/http/sendmsg?session_id='.$sess_id.'&to='.$to.'&text='.$text;
$ret = file($url);
$send = split(':', $ret[0]);
if($send[0] == 'ID') {
echo 'Message Sent';
} else {
echo 'Message Failed To Send.';
}
} else {
echo 'Auth failure :/';
exit();
}
?>
Posted on Tue 25th May 2010 · Images · 0 Comments
We went to get an anomaly scan today! Say hello to baby :]