Get City Details

The Geobytes Get City Details API is the free version of our legacy IP Locator API. You can use it to to programmatically determine the service area of an IP Address.

In PHP, for example you might access this service like this:

Which produces an output of something like this:

More than just resolves the location of IP Addresses

In addition to resolving the location of IP Addresses, the Get City Details API can accept a Geobytes Location Code (which you can lookup here), – as in this example:

or a fully qualified city name – as in this example:

or a Latitude and Longitude – as in this example where we are using it to GeoCode to the nearest city:


BTW If you would like to see a live real life example, then there is not a lot of point viewing the source of this page, as although this page does use the above example to populate the city details above, this is a server side example so you can’t see it in this page’s source.

However, because the Get City Details API also supports returning the city’s details in JSON-P format, you can also use it client side by setting the “callback” parameter – and our Ajax Autocomplete Cities List page does just this – in that case you can view the source of the page to see how the two APIs are working together to provide the user with a facility to select a city from a list, and then to display that city’s details in a web form.

Optional Default Location Parameter

Finally, there is one optional parameter that you can use to set the default location that the API will return in the 1% or so of cases where our server is unable to determine location of the IP Address. The default location is set via the “defaultlocation” parameter as shown in this example:

Example using curl and grep

returns

Reasonable Free Access Limits

If you expect to exceed the services “Reasonable Free Access Limit” of 16,384 accesses per hour, (about 4.5 look-ups per second), or wish to access the service via SSL, then you may wish to purchase some Mapbytes to pay for these additional look-ups, and thereby become a VIP.

VIP Access does have its advantages. In addition to being able to exceed the free quoter limits mentioned above, VIP clients also receive:

  • SSL Access to all of our API’s
  • Email Notification of Events that could impact their access
  • Email Support
  • VIP Priority handling of their API requests

You can become a VIP by purchasing as little as $9.99 worth of Mapbytes via the Buy Now Buttons in the right margin – that by the way works out at about 1/100th of a cent per request or 10,000 requests per dollar.

  • Jeff Sheppard

    Love this wonderful service you are providing! Just one thing I noticed, for WV you have the capital as Washington, DC, should be Charleston, WV. Thanks again for this great work!!

  • SUDHAKAR

    The new interface is waste. Please revert back to the old wwbsite.

  • TimDawg

    Wow this new interface is terrible. I used to get acceptably accurate results within 10-15 miles but now I see these results are no longer the case. A lot of the queries just seem to result in a location within the closest major city, nowhere *IN* the city, just the city itself. Nowhere outside of the city and not in the suburbs. I used to get way better results than this and I’m running these manually only a few times a year so I know what I was getting before the latest changes. That’s a total bummer.

  • Reetu Kumari

    hello, i am always getting city name as kanpur, i am accessing from banglore location. please help below is the code
    javascript url :http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity
    javascript code:
    document.write(“Welcome to visitors from “+sGeobytesCity+”, “+sGeobytesCountry);
    output: Welcome to visitors from Kanpur, India

  • Developer Test

    Hello,

    I am using GetCityDetails free service API,
    It was giving the perfect response till the date, But suddenly it’s giving me the wrong location. http://getcitydetails.geobytes.com/GetCityDetails?&fqcn=xxx.xxx.xx.xxx

    Can anyone has solution of it.

– because everybody's somewhere