Property | Type | Description | |
---|---|---|---|
$_countryCodes | array | Country list. | |
$_datafile | string | The location of the GeoIP database. | |
$_fh | resource | The open filehandle to the GeoIP database. |
Method | Description | |
---|---|---|
__construct ( string $datafile ) | Constructor. | |
countryCodeByAddr ( string $addr ) : integer | Returns the country abbreviation (2-letter) for an IP Address. | |
countryCodeByName ( string $name ) : integer | Returns the country abbreviation (2-letter) for a hostname. | |
countryIdByAddr ( string $addr ) : integer | Returns the country ID for an IP Address. | |
countryIdByName ( string $name ) : integer | Returns the country ID for a hostname. | |
countryNameByAddr ( string $addr ) : mixed | Returns the country name for an IP address. | |
countryNameByName ( string $name ) : integer | Returns the country name for a hostname. | |
getCountryInfo ( string $name ) : mixed | Returns the country ID and Name for a given hostname. |
Method | Description | |
---|---|---|
_getName ( string $code ) : string | Given a 2-letter country code, returns a country string. | |
_open ( ) : boolean | Open the GeoIP database. | |
_seekCountry ( string $ipnum ) : mixed | Finds a country by IP Address in the GeoIP database. |
public __construct ( string $datafile ) | ||
$datafile | string | The location of the GeoIP database. |
protected _seekCountry ( string $ipnum ) : mixed | ||
$ipnum | string | The IP Address to search for. |
return | mixed | The country ID or false if not found. |
public countryCodeByAddr ( string $addr ) : integer | ||
$addr | string | The IP Address. |
return | integer | The country abbreviation. |
public countryCodeByName ( string $name ) : integer | ||
$name | string | The hostname. |
return | integer | The country abbreviation. |
public countryIdByAddr ( string $addr ) : integer | ||
$addr | string | The IP Address. |
return | integer | The GeoIP country ID. |
public countryIdByName ( string $name ) : integer | ||
$name | string | The hostname. |
return | integer | The GeoIP country ID. |
public countryNameByAddr ( string $addr ) : mixed | ||
$addr | string | The IP address. |
return | mixed | The country name. |
public countryNameByName ( string $name ) : integer | ||
$name | string | The hostname. |
return | integer | The country name. |
public getCountryInfo ( string $name ) : mixed | ||
$name | string | The hostname. |
return | mixed | An array with 'code' as the country code and 'name' as the country name, or false if not found. |
protected string $_datafile | ||
return | string |