dolibarr 20.0.0
DolGeoIP Class Reference

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.
 

Detailed Description

Class to manage GeoIP conversion Usage: $geoip=new GeoIP('country',$datfile); $geoip->getCountryCodeFromIP($ip); $geoip->close();.

Definition at line 35 of file dolgeoip.class.php.

Constructor & Destructor Documentation

◆ __construct()

DolGeoIP::__construct ( $type,
$datfile )

Constructor.

Parameters
string$type'country' or 'city'
string$datfileData file

Definition at line 58 of file dolgeoip.class.php.

References dol_syslog(), and getDolGlobalString().

Member Function Documentation

◆ close()

DolGeoIP::close ( )

Close geoip object.

Returns
void

Definition at line 241 of file dolgeoip.class.php.

◆ getCountryCodeFromIP()

DolGeoIP::getCountryCodeFromIP ( $ip)

Return in lower case the country code from an ip.

Parameters
string$ipIP to scan
Returns
string Country code (two letters)

Definition at line 127 of file dolgeoip.class.php.

References getDolGlobalString().

◆ getCountryCodeFromName()

DolGeoIP::getCountryCodeFromName ( $name)

Return in lower case the country code from a host name.

Parameters
string$nameFQN of host (example: myserver.xyz.com)
Returns
string Country code (two letters)

Definition at line 185 of file dolgeoip.class.php.

References getDolGlobalString().

◆ getVersion()

DolGeoIP::getVersion ( )

Return version of data file.

Returns
string Version of datafile

Definition at line 216 of file dolgeoip.class.php.

References getDolGlobalString().


The documentation for this class was generated from the following file: