IP Geolocation API
We offer services are free IP lookup API using JavaScript Object Notation (JSON) and Extensible Markup Language (XML) to integrate IP geolocation API into your script code or website for web developer.
The IP geolocation API returns the location of an IP address public(country, regionName, city, zipcode, latitude, longitude, timezone) in JSON and XML format. Very simple only called from the a script we will return a JSON and XML response with all of the IP location details and display on the website.
What is the data IP details?
countryName: Country name
countryCode: 2 letters country code (ISO 3166-1 alpha-2 standard)
city: Name of the city
region: Name of the region
latitude: The latitude of the approximate center of the settlement found
longitude: Geographic longitude of the approximate center of the settlement found
timezone: World time zone related to this geo-location
JSON
https://visofts.com/api/json
for your own IP
https://visofts.com/api/json/?ip=123.24.158.79
for details on another IP
When called from the script the server will responds with a JSON encoded object with the following properties :
{ "query": "IP ADDRESS USED FOR QUERY" "status": "success", "country": "COUNTRY", "countryCode": "COUNTRY CODE", "regionName": "REGION NAME", "city": "CITY", "zipcode": "ZIP CODE", "lat": LATITUDE, "lon": LONGITUDE, "timezone": "TIME ZONE", }
XML
https://visofts.com/api/xml
for your own IP
https://visofts.com/api/xml/?ip=123.24.158.79
for details on another IP
When called from the script the server will responds with a XML format with the following properties :
<?xml version="1.0" encoding="UTF-8"?> <query> <status>success</status> <country><![CDATA[COUNTRY]]></country> <countryCode><![CDATA[COUNTRY CODE]]></countryCode> <regionName><![CDATA[REGION NAME]]></regionName> <city><![CDATA[CITY]]></city> <zipcode><![CDATA[ZIP CODE]]></zip> <lat><![CDATA[LATITUDE]]></lat> <lon><![CDATA[LONGITUDE]]></lon> <timezone><![CDATA[TIME ZONE]]></timezone> <query><![CDATA[IP ADDRESS USED FOR QUERY]]></query> </query>
PHP script Example
<?php function ip_details($ip) { $json = file_get_contents("https://visofts.com/api/json/"); $details = json_decode($json); return $details; } echo $ip_query= $ip_data->query; echo $ip_country= $ip_data->country; echo $ip_city= $ip_data->city; echo $ip_flags = $ip_data->countryCode; echo $ip_lat= $ip_data->lat; echo $ip_lon= $ip_data->lon; echo $ip_zipcode= $ip_data->zipcode; echo $ip_timezone= $ip_data->timezone; ?>
HTML and jQuery Example
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>visofts.com IP Geolocation API Example</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </head> <body> <table id="IPLocation"></table> <script> $.getJSON("https://visofts.com/api/json/?", function(data) { var Get_table_Row = ""; $.each(data, function(k, v) { Get_table_Row += "<tr><td>" + k + "</td><td><b>" + v + "</b></td></tr>"; }); $("#IPLocation").html(Get_table_Row); }); </script> </body> </html>
Terms of use
This is all provided as-is, with no guarantees on availability or accuracy of the results. We'll certainly do our best to make the service highly-available though, and the results accurate. You can use it for any purpose. Attribution is not required, but is appreciated.