Very simple implementation

Just make a request by the API URL and receive results back via needed format. By default json format used, it's very convenient to parse the result.


API request examples

Our examples use secure transfer protocol. This option available only for payed accounts. If you plan to use free version of our API just change "https://" to "http://", or your requests will be redirected automatically.


PHP code example

Backend example below will print city name "Los Angeles" an english language.

<?php
$resultJson = file_get_contents('https://geo.foxlis.com/get-geo-by-ip/23.55.115.223');

$jsonParsedResult = json_decode($resultJson);

echo $jsonParsedResult->city->names->en;
?>

JavaScript code example

Frontend example below will alert your web-service visitor city name an english language.

<script>
let endpoint = 'https://geo.foxlis.com/get-geo-by-ip';
let xhr = new XMLHttpRequest();

xhr.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    let response = JSON.parse(this.responseText);

    alert(response.city.names.en);
  }
};

xhr.open('GET', endpoint, true);
xhr.send();
</script>

Format support

Format Request Url Example
Json https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=json
Xml https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=xml
PHP Array https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=array
Yaml https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=yaml
Csv https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=csv

Languages support

Language Request Url Example
English https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=en
Chinese https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=zh-CN
French https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=fr
Russian https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=ru
German https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=de
Spanish https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=es
Japanese https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=ja
Portuguese https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang=pt-BR

You can combine languages like an example request URL below:

https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?lang[]=en&lang[]=ru&lang[]=zh-CN

You can use languages with format like an example request URL below:

https://geo.foxlis.com/get-geo-by-ip/23.55.115.223?format=xml&lang[]=en&lang[]=ru&lang[]=zh-CN

Data description

Main Data Embedded Data
city
  • names
continent
  • names
  • code
country
  • names
  • iso_code
location
  • accuracy_radius
  • latitude
  • longitude
  • time_zone
postal
  • code
registered_country
  • names
  • iso_code
subdivisions
  • names
  • iso_code