Getting location info from a Frontier script

Not sure how new this protocol is, but there appears to be a standard for getting location info in XML. You provide an IP address, and the service returns back the geographic coordinates, the name of the location, the country.

If you don’t specify the IP address, it uses the client IP that made the call. I need this because Amazon EC2 servers are assigned internal IP addresses. This is a way to find out the IP address you’re seen by externally. I could have written my own web service for this, but then I’d have to keep it running. :-)

So there’s a new verb, tcp.getLocationInfo.

tcp.getLocationInfo (adrtable, ip=nil, apiUrl=nil)

It takes three parameters, the address of a table to receive the location info and an optional IP address and address of the web service (in case you want to call a different one from the default).

By default it calls this web service:

http://api.hostip.info/?ip=75.101.165.156

If you click on that link you’ll see the XML that this verb parses for you.

4 responses to this post.

  1. Clicking on the link displays raw code in both Firefox and IE8.

    When I remove the existing IP from the link and read the code it resolves my IP correctly but it says I’m in Atlanta instead of Las Vegas.

    Reply

    • It’s like telling a doctor — when I slice open my arm this red stuff comes spurting out. Yeah, that’s right — he’d say. 🙂

      This is not for end-users Rich, it’s infrastructure.

      Reply

  2. Posted by Rich on March 28, 2010 at 10:39 pm

    Don’t know where my brain was, but, man did I have that one coming. – I used their service on a project back in 2006 😦

    What I was trying to elicit was a response as to the accuracy of the data. I’ve tried 3 ips and gotten either incorrect or no information, and I was wondering if you had any input.

    Reply

  3. […] An den Wochenenden scheint Dave Winer Zeit zu haben, am OPML Editor zu basteln, und so hat er dieses Mal einen Geolocation-Service für Frontier geschrieben: Getting location info from a Frontier script. […]

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: