Description Usage Arguments Details Value Author(s) References See Also Examples
Implements a lookup using the InfoDB API to determine point coordinates for a given ip address. There is a package dependency here for rjson and you must have this. Also, you should get your own API code and supplement it for the one used here. See Details Section.
1 | geoIP(x)
|
x |
x is the ip address in ipV4 format |
The lookup here is performed by using the InfoDB ip lookup page at http://ipinfodb.com/ via API call to http which is structured as follows:
PATTERN: http://api.ipinfodb.com/v3/ip-city/?key=YOUR_API_KEY&ip=XXX.XXX.XXX.XXX&format=json
You can get your own API key, (yes, it's free), and supplement it into the code for the geoIP function at http://ipinfodb.com/ip_location_api.php. The data will be returned in a JSON document on a page which is ingested.
A list is returned containing the following elements:
ipaddress |
Input ip address. |
statusCode |
Returned status code from lookup. |
latitude |
Point coordinate - latitude. |
longitude |
Point coordinate - longitude. |
statusMessage |
Returned status message from lookup. |
countryCode |
Country code from ip lookup. |
countryName |
Country name from ip lookup. |
regionName |
State/region/province from ip lookup. |
cityName |
City from ip lookup. |
zipCode |
Postal code from ip lookup. |
timeZone |
Timezone from ip lookup. |
Randall Shane, PhD
rshane@basexvi.com
http://ipinfodb.com/ip_location_api.php
1 2 | x <- "38.122.8.198"
geoIP(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.