GEOIP
NAME
geoip - Finds geolocalisation information about an ip address.
SYNOPSIS
geoip ([error:variable,db:"string"],ip:"string");
DESCRIPTION
This function is used to retrieve geolocalisation information about an IP address.
PARAMETERS
- ip
- IP address for which geolocalisation information is desired.
- error
- Parameter to use to return error information.
- db
- Database file used to get the geolocalisation information. Defaults to /usr/local/website/GeoIPCity.dat which is part of any Extenso installation.
RETURN
- Array
- Associative array of geolocalisation information
MODULES
To use this module, you must specify the following in /usr/local/website/site.conf:
Module geoip {
Library : "/usr/local/lib/libsngeoip.so"
Init : "sngeoip_init"
}
EXAMPLES
res=<{geoip(error: t,"50.21.175.111"); t.errcode;}>. return
res={"region":"QC","region_name":"Quebec","areacode":0,"ip":"50.21.175.111",
"city":"Montreal","timezone":"America/Montreal","longitude":-73.5833,"latitude":45.5,"postal_code":"","dmacode":0,"country_code":"CA"}0.
res=<{geoip(1);}>. return .*Can't find record for this IP.*
res=<{geoip(error:t,1); t}>. return .*Can't find record for this IP.*
res=<{geoip("1");}>. return .*Can't find record for this IP.*
Test geoip
<{
a= connection();
geoip(a.client_ip);
}>
return
Test geoip
{"region":"QC","region_name":"Quebec","areacode":0,"ip":"24.225.142.113","city":"L'assomption","timezone":"America/Montreal","longitude":-73.4333,"latitude":45.8167,"postal_code":"","dmacode":0,"country_code":"CA"}
SEE ALSO
AUTHOR
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit