OpenReverseIP public API

RESTful API

Show IP Address and location

GET /api/v1.0/ip_addresses/self

Response example

        {
  "ip": "5.2.199.40",
  "latitude": 55.3569749147174,
  "longitude": 86.0781277947915,
  "state": "Kemerovo Oblast",
  "city": "Kemerovo",
  "country": "Russian Federation"
}

JS API

Include this lib into your web page:

<script type="text/javascript" src="//www.open-geo-ip.com/api.js"></script>

And from your web page:

orp.ready(readyCallback);

To register ready callback handler

orp.ready(opts, readyCallback);

To register ready callback handler with options to override the default options

opts must be a JavaScript object with the following attributes:

orp.configure(opts);

To override the default options

orp.getLocation(resultCallback);

This method is provided so that when getLocation is called, it will ask users for location permission, must be used when orp is ready.

For example:

      orp.ready(function() {
  orp.getLocation(function(err, result) {
    if (!err) {
      console.log(result);
    } else {
      alert(err.message);
    }
  });
});

If it has allowed permission, send this location information to the server and result the location result.

Otherwise, ask the server for the ip location and result the location result.

If there is any error, pass the error object to the onResultCallback .

onResultCallback will take 2 arguments: error and result object.

If there is an error , the onResultCallback will be passed only the error object

If there is no error , the onResultCallback will be passed with 2 objects, the first is null error object, and the 2nd one is the result object.

Supported Browsers