library/Dot/Geoip/Country.php
Properties
Description
DotBoost Technologies Inc.
DotKernel Application Framework
Classes
Dot_Geoip_Country
Properties
No
No
Description
Geo IP Country - connect to GeoIP.dat database to return the country based on IP address
Methods
__construct,
_geoipClose,
_geoipCountryCodeByAddr,
_geoipCountryIdByAddr,
_geoipOpen,
_geoipSeekCountry,
_getOrg,
_getRegion,
_setupSegments,
geoipCountryCodeByName,
geoipCountryIdByName,
geoipCountryNameByAddr,
geoipCountryNameByName,
geoipDatabaseInfo,
geoipOrgByAddr,
geoipRegionByAddr,
getCountryByAddr,
Description
Constructor
Return value
Tags
Name |
Description |
access |
public |
_geoipClose(
)
:
bool
Description
Close opened file
Return value
Tags
Name |
Description |
access |
private |
_geoipCountryCodeByAddr(
string
$addr,
)
:
string
Description
Get country code based on IP address
Arguments
Name |
Type |
Description |
Default |
$addr |
string |
|
|
Return value
Tags
Name |
Description |
access |
private |
_geoipCountryIdByAddr(
string
$addr,
)
:
int
Description
Get country id based on IP address
Arguments
Name |
Type |
Description |
Default |
$addr |
string |
|
|
Return value
Tags
Name |
Description |
access |
private |
_geoipOpen(
string
$filename,
int
$flags,
)
:
void
Description
Open Geoip database
Arguments
Name |
Type |
Description |
Default |
$filename |
string |
|
|
$flags |
int |
|
|
Return value
Tags
Name |
Description |
access |
private |
_geoipSeekCountry(
$ipNum,
)
:
int
Description
Search the country based on IP address
Arguments
Name |
Type |
Description |
Default |
$ipNum |
n/a |
|
|
Return value
Tags
Name |
Description |
access |
private |
_getOrg(
string
$ipnum,
)
:
string
Description
Get GeoIP Organization by IP address
Note: file GeoIPOrg.dat is required
Arguments
Name |
Type |
Description |
Default |
$ipnum |
string |
|
|
Return value
_getRegion(
object
$ipnum,
)
:
array
Description
Get GeoIp region based on IP address.Return an array with country code and region name
Arguments
Name |
Type |
Description |
Default |
$ipnum |
object |
|
|
Return value
Tags
Name |
Description |
access |
private |
_setupSegments(
)
:
void
Description
Setup segments from GeoIp
Return value
Tags
Name |
Description |
access |
private |
geoipCountryCodeByName(
string
$name,
)
:
string
Description
Get country code by name
Arguments
Name |
Type |
Description |
Default |
$name |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
geoipCountryIdByName(
string
$name,
)
:
int
Description
Get the country ID by name.Return the ID of the country or false if no country found
Arguments
Name |
Type |
Description |
Default |
$name |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
geoipCountryNameByAddr(
string
$addr,
)
:
string
Description
Get country name based on IP address
Arguments
Name |
Type |
Description |
Default |
$addr |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
geoipCountryNameByName(
string
$name,
)
:
string
Description
Get country name by name
Arguments
Name |
Type |
Description |
Default |
$name |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
geoipDatabaseInfo(
string
$path,
)
:
string
Description
Get file version
Return database name and version
Arguments
Name |
Type |
Description |
Default |
$path |
string |
- path to GeoIP.dat database file |
|
Return value
Tags
Name |
Description |
access |
public |
geoipOrgByAddr(
string
$addr,
)
:
string
Description
Get Orgasnization based on IP address
Arguments
Name |
Type |
Description |
Default |
$addr |
string |
|
|
Return value
Tags
Name |
Description |
access |
private |
geoipRegionByAddr(
string
$addr,
)
:
array
Description
Get GeoIp region based on IP address
Arguments
Name |
Type |
Description |
Default |
$addr |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
getCountryByAddr(
string
$path,
string
$ip,
)
:
array
Description
Get the country by IP
Return an array with : short name, like 'us' and long name, like 'United States'
Arguments
Name |
Type |
Description |
Default |
$path |
string |
- path to GeoIP.dat database file |
|
$ip |
string |
|
|
Return value
Tags
Name |
Description |
access |
public |
Properties
$_databaseSegments,
$_databaseType,
$_filehandle,
$_flags,
$_geoipContinentCodes,
$_geoipCountryCodeToNumber,
$_geoipCountryCodes,
$_geoipCountryCodes3,
$_geoipCountryNames,
$_memoryBuffer,
$_recordLength,
$_shmid,
private
$_databaseSegments
=
Database segmentsint
private
$_databaseType
=
Database typeint
private
$_filehandle
=
File handle identifierresource
private
$_flags
=
Flags country codestring
private
$_geoipContinentCodes
=
array
Array with continent codesarray
private
$_geoipCountryCodeToNumber
=
array
Array with country code to number corespondencearray
private
$_geoipCountryCodes
=
array
Array with country codes (2 chars)array
private
$_geoipCountryCodes3
=
array
Array with country codes (3 chars)array
private
$_geoipCountryNames
=
array
Array with country namesarray
private
$_memoryBuffer
=
Memmory buffered - the read stringstring
private
$_recordLength
=
Record lengtint
private
$_shmid
=
ID returned by shmop_open() function to access the shared memory segment int