loading-img

JSON Response formatServer side

GEThttps://ip-get-geolocation.com/api/json/address_ip?key=your_api_key

The 2 variable elements of this URL (address_ip and your_api_key) have to be replaced by some values before performing the request.
A correct URL would be for exemple:
https://ip-get-geolocation.com/api/json/35.188.125.133?key=f25a2fc72690b780b2a14e140ef6a9e0
or if your are using IPv6:
https://ip-get-geolocation.com/api/json/5800:10C3:E3C3:F1AA:48E3:D925:D494:AAFF?key=f25a2fc72690b780b2a14e140ef6a9e0

Variables description

Name Description
address_ip *
string
(query)

Specify the ip address you want to geolocalize. IPv4 or IPv6 format.

your_api_key *
string
(query)

Specify your API Key. (It is sent to you by Email when you register)

Response on success

Field name Description
status

Equal to the string "success"
This field determines that the request succeeded.

as

AS number and name, separated by space

country

Country name

countryCode

2 digits country code

city

City name

isp

Internet service provider name

lat

Latitude GPS coordinate

lon

Longitude GPS coordinate

org

Organization name

query

The IP address you submited

region

2 digits region code

regionName

Region name

timezone

City timezone

zip

Postal zip code

Response example on success
{"as":"AS15169 Google LLC","city":"Newark","country":"United States","countryCode":"US","isp":"Google Cloud","lat":40.7357,"lon":-74.1724,"org":"Google Cloud","query":"35.188.125.133","region":"NJ","regionName":"New Jersey","status":"success","timezone":"America/New_York","zip":"07175"}

Response on failure

Field name Description
status

Equal to the string "fail"
This field determines that the request failed.

msg

Contains the reason of the failure, basically if your suscription runs out, or if you reach limitations on free plan.

Response example on failure
{"status":"fail","msg":"This API Key does not exist"}

XML Response formatServer side

GEThttps://ip-get-geolocation.com/api/xml/address_ip?key=your_api_key

The 2 variable elements of this URL (address_ip and your_api_key) have to be replaced by some values before performing the request.
A correct URL would be for exemple:
https://ip-get-geolocation.com/api/xml/35.188.125.133?key=f25a2fc72690b780b2a14e140ef6a9e0
or if your are using IPv6:
https://ip-get-geolocation.com/api/xml/5800:10C3:E3C3:F1AA:48E3:D925:D494:AAFF?key=f25a2fc72690b780b2a14e140ef6a9e0

Variables description

Name Description
address_ip *
string
(query)

Specify the ip address you want to geolocalize. IPv4 or IPv6 format.

your_api_key *
string
(query)

Specify your API Key. (It is sent to you by Email when you register)

Response on success

Field name Description
status

Equal to the string "success"
This field determines that the request succeeded.

as

AS number and name, separated by space

country

Country name

countryCode

2 digits country code

city

City name

isp

Internet service provider name

lat

Latitude GPS coordinate

lon

Longitude GPS coordinate

org

Organization name

query

The IP address you submited

region

2 digits region code

regionName

Region name

timezone

City timezone

zip

Postal zip code

Response example on success
<?xml version="1.0" encoding="UTF-8"?>
<query>
<status><![CDATA[success]]></status>
<country><![CDATA[United States]]></country>
<countryCode><![CDATA[US]]></countryCode>
<region><![CDATA[NJ]]></region>
<regionName><![CDATA[New Jersey]]></regionName>
<city><![CDATA[Newark]]></city>
<zip><![CDATA[07175]]></zip>
<lat><![CDATA[40.7357]]></lat>
<lon><![CDATA[-74.1724]]></lon>
<timezone><![CDATA[America/New_York]]></timezone>
<isp><![CDATA[Google Cloud]]></isp>
<org><![CDATA[Google Cloud]]></org>
<as><![CDATA[AS15169 Google LLC]]></as>
<query><![CDATA[35.188.125.133]]></query>
</query>

Response on failure

Field name Description
status

Equal to the string "fail"
This field determines that the request failed.

msg

Contains the reason of the failure, basically if your suscription runs out, or if you reach limitations on free plan.

Response example on failure
<?xml version="1.0" encoding="UTF-8"?>
<query>
<status><![CDATA[fail]]></status>
<msg><![CDATA[This API Key does not exist]]></msg>
</query>

CSV Response formatServer side

GEThttps://ip-get-geolocation.com/api/csv/address_ip?key=your_api_key

The 2 variable elements of this URL (address_ip and your_api_key) have to be replaced by some values before performing the request.
A correct URL would be for exemple:
https://ip-get-geolocation.com/api/csv/35.188.125.133?key=f25a2fc72690b780b2a14e140ef6a9e0
or if your are using IPv6:
https://ip-get-geolocation.com/api/csv/5800:10C3:E3C3:F1AA:48E3:D925:D494:AAFF?key=f25a2fc72690b780b2a14e140ef6a9e0

Variables description

Name Description
address_ip *
string
(query)

Specify the ip address you want to geolocalize. IPv4 or IPv6 format.

your_api_key *
string
(query)

Specify your API Key. (It is sent to you by Email when you register)

Response on success

Field name Description
status

Equal to the string "success"
This field determines that the request succeeded.

as

AS number and name, separated by space

country

Country name

countryCode

2 digits country code

city

City name

isp

Internet service provider name

lat

Latitude GPS coordinate

lon

Longitude GPS coordinate

org

Organization name

query

The IP address you submited

region

2 digits region code

regionName

Region name

timezone

City timezone

zip

Postal zip code

Response example on success
as,city,country,countryCode,isp,lat,lon,org,query,region,regionName,status,timezone,zip
AS15169 Google LLC,Newark,United States,US,Google Cloud,40.7357,-74.1724,Google Cloud,35.188.125.133,NJ,New Jersey,success,America/New_York,07175

Response on failure

Field name Description
status

Equal to the string "fail"
This field determines that the request failed.

msg

Contains the reason of the failure, basically if your suscription runs out, or if you reach limitations on free plan.

Response example on failure
status,msg
fail,This API Key does not exist

PHP serialized Response formatServer side

GEThttps://ip-get-geolocation.com/api/serializedphp/address_ip?key=your_api_key

The 2 variable elements of this URL (address_ip and your_api_key) have to be replaced by some values before performing the request.
A correct URL would be for exemple:
https://ip-get-geolocation.com/api/serializedphp/35.188.125.133?key=f25a2fc72690b780b2a14e140ef6a9e0
or if your are using IPv6:
https://ip-get-geolocation.com/api/serializedphp/5800:10C3:E3C3:F1AA:48E3:D925:D494:AAFF?key=f25a2fc72690b780b2a14e140ef6a9e0

Variables description

Name Description
address_ip *
string
(query)

Specify the ip address you want to geolocalize. IPv4 or IPv6 format.

your_api_key *
string
(query)

Specify your API Key. (It is sent to you by Email when you register)

Response on success

Field name Description
status

Equal to the string "success"
This field determines that the request succeeded.

as

AS number and name, separated by space

country

Country name

countryCode

2 digits country code

city

City name

isp

Internet service provider name

lat

Latitude GPS coordinate

lon

Longitude GPS coordinate

org

Organization name

query

The IP address you submited

region

2 digits region code

regionName

Region name

timezone

City timezone

zip

Postal zip code

Response example on success
a:14:{s:2:"as";s:18:"AS15169 Google LLC";s:4:"city";s:6:"Newark";s:7:"country";s:13:"United States";s:11:"countryCode";s:2:"US";s:3:"isp";s:12:"Google Cloud";s:3:"lat";d:40.7357;s:3:"lon";d:-74.1724;s:3:"org";s:12:"Google Cloud";s:5:"query";s:14:"35.188.125.133";s:6:"region";s:2:"NJ";s:10:"regionName";s:10:"New Jersey";s:6:"status";s:7:"success";s:8:"timezone";s:16:"America/New_York";s:3:"zip";s:5:"07175";}

Response on failure

Field name Description
status

Equal to the string "fail"
This field determines that the request failed.

msg

Contains the reason of the failure, basically if your suscription runs out, or if you reach limitations on free plan.

Response example on failure
a:2:{s:6:"status";s:4:"fail";s:3:"msg";s:27:"This API Key does not exist";}

PHP SDK

Click here to download the single file PHP class that implements the API (PHP version >=5)
After you have downloaded the class, copy the file into your project directory, and try the following examples:

<?php 
include 'MasterClass_ip2location-api-v1.0.php';

$APIKey = 'PUT_HERE_YOUR_API_KEY';

//Create the object
$ip2locationapiObject = new ip2locationapi($APIKey, 'json', '1.152.109.38');

//Exemple 1:
//Perform the request and get the JSON result converted into a PHP Array
$ip2locationapiArray = json_decode($ip2locationapiObject->performRequest(), true);
echo '<table>';
foreach($ip2locationapiArray as $k=>$v){
	echo '<tr><td>'.$k.'</td><td>'.$v.'</td></tr>';
}
echo '</table><hr/>';

//Exemple 2:
//Perform the request and get the PHP array from serialized answer
$ip2locationapiObject->setOutputFormat('serializedphp');
$ip2locationapiObject->setLookupIP('47.247.246.47');
$ip2locationapiArray2 = unserialize( $ip2locationapiObject->performRequest() );
echo '<table>';
foreach($ip2locationapiArray2 as $k=>$v){
	echo '<tr><td>'.$k.'</td><td>'.$v.'</td></tr>';
}
echo '</table>';
?>

AJAX callClient side

GEThttps://ip-get-geolocation.com/api/json/address_ip

On client side, the calls to the API are free, you can integrate the functionality right now, follow this exemple:

Exemple HTML/Jquery
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>ip-get-geolocation.com Geolocation Demo</title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    </head>
    <body>
        <table id="GeoResults"></table>
        <script>
        $.getJSON("http://ip-get-geolocation.com/api/json/35.188.125.133", function(data) {
            var table_body = "";
            $.each(data, function(k, v) {
                table_body += "<tr><td>" + k + "</td><td><b>" + v + "</b></td></tr>";
            });
            $("#GeoResults").html(table_body);
        });
        </script>
    </body>
</html>

For a live exemple, click here

Javascript Function CallbackClient side

GEThttps://ip-get-geolocation.com/api/json/address_ip?callback=myFunction

On client side, the calls to the API are free, you can integrate the functionality right now, follow this exemple:

Exemple HTML/Javascript
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>ip-get-geolocation.com Geolocation Demo</title>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    </head>
    <body>
        <table id="GeoResults"></table>
        <script>
			function myFunction(theObject){
				var table_body = "";
				for (var prop in theObject) {
					if(!theObject.hasOwnProperty(prop)) continue;
					table_body += "<tr><td>" + prop + "</td><td><b>" + theObject[prop] + "</b></td></tr>";
				}
				$("#GeoResults").html(table_body);
			}
        </script>
		<script src="//ip-get-geolocation.com/api/json/35.188.125.133?callback=myFunction"></script>
    </body>
</html>

For a live exemple, click here