|
dolibarr 24.0.1
|
Class to manage GeoIP conversion Usage: $geoip=new GeoIP('country',$datfile); $geoip->getCountryCodeFromIP($ip); $geoip->close();. More...
Public Member Functions | |
| __construct ($type, $datfile) | |
| Constructor. | |
| getCountryCodeFromIP ($ip) | |
| Return in lower case the country code from an ip. | |
| getCountryCodeFromName ($name) | |
| Return in lower case the country code from a host name. | |
| getVersion () | |
| Return version of data file. | |
| close () | |
| Close geoip object. | |
Private Member Functions | |
| getGeoIp2IsoCode ($ipOrName) | |
| Return the ISO country code for an IP or a host name using the embedded GeoIP2 reader. | |
Class to manage GeoIP conversion Usage: $geoip=new GeoIP('country',$datfile); $geoip->getCountryCodeFromIP($ip); $geoip->close();.
Definition at line 36 of file dolgeoip.class.php.
| DolGeoIP::__construct | ( | $type, | |
| $datfile ) |
Constructor.
| 'country'|'city' | $type 'country' or 'city' | |
| string | $datfile | Data file |
Definition at line 59 of file dolgeoip.class.php.
References dol_syslog(), and getDolGlobalString().
| DolGeoIP::close | ( | ) |
| DolGeoIP::getCountryCodeFromIP | ( | $ip | ) |
Return in lower case the country code from an ip.
| string | $ip | IP to scan |
Definition at line 164 of file dolgeoip.class.php.
References getDolGlobalString(), and getGeoIp2IsoCode().
| DolGeoIP::getCountryCodeFromName | ( | $name | ) |
Return in lower case the country code from a host name.
| string | $name | FQN of host (example: myserver.xyz.com) |
Definition at line 208 of file dolgeoip.class.php.
References getDolGlobalString(), and getGeoIp2IsoCode().
|
private |
Return the ISO country code for an IP or a host name using the embedded GeoIP2 reader.
A Country database is read with country(), but a City database (which also embeds the country record) is read with city(), so a City datafile configured as the country datafile still resolves instead of failing with a BadMethodCallException.
| string | $ipOrName | IP address or host name to look up |
Definition at line 138 of file dolgeoip.class.php.
References string.
Referenced by getCountryCodeFromIP(), and getCountryCodeFromName().
| DolGeoIP::getVersion | ( | ) |
Return version of data file.
Definition at line 231 of file dolgeoip.class.php.
References getDolGlobalString().