This is a free for finding IP address geo location. The database is very accurate and contains the following items as out:
- Country (code/name)
- Region (code/name)
- City
- Zip Code
- Latitude
- Longitude
Data is served in different formats, such as CSV, XML or JSON.
- CSV: http://freegeoip.appspot.com/csv/[ip-address]
- XML: http://freegeoip.appspot.com/xml/[ip-address]
- JSON: http://freegeoip.appspot.com/json/[ip-address]
Requests are simple REST URLs, allowing anyone to query from any language.
for example: in Asp.Net
reader.WhitespaceHandling = WhitespaceHandling.Significant;
string state = “”;
string city = “”;
while(reader.Read())
{
if (reader.Name.ToString() == “RegionName”)
{
state = reader.ReadString().ToString();
}
if (reader.Name.ToString() == “City”)
{
city = reader.ReadString().ToString();
}
}
The Comma Separated Values format will always return 10 columns in a single line, like this:
status,ip,countrycode,countryname,regioncode, regionname,city,zipcode,latitude,longitude
The data in the first two columns will always be present. Status can be either true or false, and must be used to determine the success or failure of the query.
The Extensible Markup Language format will always return the same document structure, with a Status node containing either true or false, used to determine the success or failure of a query.
Here is an example of the reply:
<Response>
<Status>true</Status>
<Ip>x.x.x.x</Ip>
<CountryCode>IN</CountryCode>
<CountryName>India</CountryName>
<RegionCode>TN</RegionCode>
<RegionName>Tamil Nadu</RegionName>
<City>Chennai</City>
<ZipCode>xxxxx</ZipCode>
<Latitude>-xx.xxxx</Latitude>
<Longitude>-xx.xxxx</Longitude>
</Response>
The JavaScript Object Notation is also available, and is the preferred method for retrieving the results.
The status key can be either true or false and is used to determine the success or failure of a query:
“countrycode”:”IN”,”countryname”:”India”,
“regioncode”:”TN”,”regionname”:”Tamil Nadu”,
“city”:”Chennai”,”zipcode”:”xxxx”,
“latitude”:-xx.xxxx,”longitude”:-xx.xxxx}
*Note:-Latitude,Longitude are very useful for Map service.
Sometimes it is showing this message.
“This Google App Engine application is temporarily over its serving quota. Please try again later.”
I hope, Freegeoip is developed by Google.