\Horde_Nls_Geoip

Horde optimized interface to the MaxMind IP Address->Country listing.

Based on PHP geoip.inc library by MaxMind LLC: http://www.maxmind.com/download/geoip/api/php/

Originally based on php version of the geoip library written in May 2002 by jim winstead jimw@apache.org

Copyright 2003 MaxMind LLC Copyright 2003-2017 Horde LLC (http://www.horde.org/)

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
getCountryInfo()
countryIdByName()
countryCodeByName()
countryNameByName()
countryIdByAddr()
countryCodeByAddr()
countryNameByAddr()
No public properties found
GEOIP_COUNTRY_BEGIN
STRUCTURE_INFO_MAX_SIZE
STANDARD_RECORD_LENGTH
_open()
_seekCountry()
_getName()
$_countryCodes
$_datafile
$_fh
N/A
No private methods found
No private properties found
N/A

Constants

GEOIP_COUNTRY_BEGIN

GEOIP_COUNTRY_BEGIN

STRUCTURE_INFO_MAX_SIZE

STRUCTURE_INFO_MAX_SIZE

STANDARD_RECORD_LENGTH

STANDARD_RECORD_LENGTH

Properties

$_countryCodes

$_countryCodes : array

Country list.

Type

array

$_datafile

$_datafile : string

The location of the GeoIP database.

Type

string

$_fh

$_fh : resource

The open filehandle to the GeoIP database.

Type

resource

Methods

__construct()

__construct(string  $datafile) 

Constructor.

Parameters

string $datafile

The location of the GeoIP database.

getCountryInfo()

getCountryInfo(string  $name) : mixed

Returns the country ID and Name for a given hostname.

Parameters

string $name

The hostname.

Returns

mixed —

An array with 'code' as the country code and 'name' as the country name, or false if not found.

countryIdByName()

countryIdByName(string  $name) : integer

Returns the country ID for a hostname.

Parameters

string $name

The hostname.

Returns

integer —

The GeoIP country ID.

countryCodeByName()

countryCodeByName(string  $name) : integer

Returns the country abbreviation (2-letter) for a hostname.

Parameters

string $name

The hostname.

Returns

integer —

The country abbreviation.

countryNameByName()

countryNameByName(string  $name) : integer

Returns the country name for a hostname.

Parameters

string $name

The hostname.

Returns

integer —

The country name.

countryIdByAddr()

countryIdByAddr(string  $addr) : integer

Returns the country ID for an IP Address.

Parameters

string $addr

The IP Address.

Returns

integer —

The GeoIP country ID.

countryCodeByAddr()

countryCodeByAddr(string  $addr) : integer

Returns the country abbreviation (2-letter) for an IP Address.

Parameters

string $addr

The IP Address.

Returns

integer —

The country abbreviation.

countryNameByAddr()

countryNameByAddr(string  $addr) : mixed

Returns the country name for an IP address.

Parameters

string $addr

The IP address.

Returns

mixed —

The country name.

_open()

_open() : boolean

Open the GeoIP database.

Returns

boolean —

False on error.

_seekCountry()

_seekCountry(string  $ipnum) : mixed

Finds a country by IP Address in the GeoIP database.

Parameters

string $ipnum

The IP Address to search for.

Returns

mixed —

The country ID or false if not found.

_getName()

_getName(string  $code) : string

Given a 2-letter country code, returns a country string.

Parameters

string $code

The country code.

Returns

string —

The country string.