Register FREE Username and API key at http://www.locatorhq.com[^]
Then, get the data by accessing:
http://api.locatorhq.com/?user=<username>&key=<apikey>&ip=<ipaddress>
Example:
http://api.locatorhq.com/?user=john3041&key=27364b3d6060c9e0738754c9be60908ab00ac7&ip=64.233.191.255
Data return in this format:
<countryCode>,<countryName>,<region>,<city>,<latitude>,<longitude>
Example:
US,United States,California,Mountain View,34.305,-86.2981,64.233.191.255
Data format suports XML and JSON, just add a parameter of format
:
http://api.locatorhq.com/?user=<username>&key=<apikey>&ip=<ipaddress>&format=xml
http://api.locatorhq.com/?user=<username>&key=<apikey>&ip=<ipaddress>&format=json
For C# ASP.NET, you can get the data at code behind by using WebClient
.
Example:
string url = "http://api.locatorhq.com/?user=john3041&key=27364b3d6060c9e0738754c9be60908ab00ac7&ip=64.233.191.255";
WebClient wc = new WebClient();
byte[] ba = wc.DownloadData(url);
string text = System.Text.Encoding.UTF8.GetString(ba);