开发者

How to create a system that will receive SMS messages with a location in the title and automatically transfer that information into Google Maps?

开发者 https://www.devze.com 2022-12-21 04:08 出处:网络
I\'m looking at building a simple app based around location. Obviously given that lots of people don\'t have access to smartphones etc, I\'m trying to figure out a way to allo开发者_开发技巧w them to

I'm looking at building a simple app based around location. Obviously given that lots of people don't have access to smartphones etc, I'm trying to figure out a way to allo开发者_开发技巧w them to text in their address/location details to an automated system that will locate them on Google Maps. Is this possible? And if it is possible, is it possible to also automate a system that will then send that location and data to a third party (either via 3g, wifi or SMS)?


You need a SMS service provider really, to send a recieve bulk sms. You can get away with a tethered phone if nessecary, but you're going to have to pay for sms either way and tethered phones tend to require a fair bit of maintainence. I wouldn't nessecarily recommend any SMS provider over others, but be wary of any that seem overly cheap - there are some dodgy ones who will do things like taking your contact numbers and selling/spamming them. One like Clickatell should do you.

Google Maps has an API with some good documentation. I'm not quite sure what you want to do from your description, but hopefully you should find what you want there. Failing that, don't forget to look at Yahoo! Maps API or Bing Maps API. Unlike search, mapping is not a one horse race...


To receive incoming SMSes, you would normally need an SMS gateway which supports incoming SMS.

Clickatell is a popular SMS gateway. It works in 200+ countries, and ironically it is being advertised right next to the text box I'm writing this answer!

For incoming SMSes, you would have to expose an interface from your server through: HTTP, SMPP, SOAP or FTP. For example if you use the HTTP GET and you provide this URL to Clickatell: http://www.yourdomain.com/incoming-sms/, then Clickatell will send you this type of GET request with every incoming SMS:

https://www.yourdomain.com/incoming-sms/?
   api_id=12345&
   from=279991235642&
   to=27123456789&
   timestamp=2010-02-1921:29:50&
   text=Here%20is%20the%20messagetext&
   charset=ISO-8859-1&
   moMsgId=b2aee337abd962489b123fda9c3480fa

As soon as you receive the address within the SMS body, you would have to get the latitude/longitude coordinates through the Google Maps API Server-side Geocoding Service. If you are using php, this would look something like this:

$url = 'http://maps.google.com/maps/geo?q=Oxford+Street,+London,+UK&output=csv&sensor=false';

$data = @file_get_contents($url);

$result = explode(",", $data);

echo $result[0]; // status code
echo $result[1]; // accuracy
echo $result[2]; // latitude
echo $result[3]; // longitude

Once you get the latitude and longitude, you can store them in a database for later plotting on Google Maps.

Note that the server-side geocoding service may only be used in conjunction with displaying results on a Google map; geocoding results without displaying them on a map is prohibited by the Google Maps API Terms of Service License Restrictions.


If you want to use the Clickatell SMS gateway to send a response back via SMS, their API offers a choice of outgoing connection options via: HTTP/S, SMPP, SMTP, FTP, XML, SOAP, COM Object.

The HTTP/S method is as simple as this: http://api.clickatell.com/http/sendmsg?to=NUMBER&msg=Message+Body+Here (Clickatell API Guide).

The SMTP method consists of sending a plain-text e-mail to: sms@messaging.clickatell.com, with the following body:

user: xxxxx
password: xxxxx
api_id: xxxxx
to: 448311234567
text: Meet me at home


It sounds like you are talking about Google SMS's maps command.

You send an SMS to 466453 ("GOOGLE" on most devices) and if you had texted

map 5th avenue new york

you'd get back

Map: 5th Ave, New York http://m.google.com/u/x195Ag

Taping that link brings you to a google maps of that address (though in safari, not the google maps app).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号