PHP Class Horde_Nls_Geoip, horde

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 Copyright 2003 MaxMind LLC Copyright 2003-2016 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 COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Michael Slusarz ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_countryCodes array Country list.
$_datafile string The location of the GeoIP database.
$_fh resource The open filehandle to the GeoIP database.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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.

Method Details

__construct() public méthode

Constructor.
public __construct ( string $datafile )
$datafile string The location of the GeoIP database.

_getName() protected méthode

Given a 2-letter country code, returns a country string.
protected _getName ( string $code ) : string
$code string The country code.
Résultat string The country string.

_open() protected méthode

Open the GeoIP database.
protected _open ( ) : boolean
Résultat boolean False on error.

_seekCountry() protected méthode

Finds a country by IP Address in the GeoIP database.
protected _seekCountry ( string $ipnum ) : mixed
$ipnum string The IP Address to search for.
Résultat mixed The country ID or false if not found.

countryCodeByAddr() public méthode

Returns the country abbreviation (2-letter) for an IP Address.
public countryCodeByAddr ( string $addr ) : integer
$addr string The IP Address.
Résultat integer The country abbreviation.

countryCodeByName() public méthode

Returns the country abbreviation (2-letter) for a hostname.
public countryCodeByName ( string $name ) : integer
$name string The hostname.
Résultat integer The country abbreviation.

countryIdByAddr() public méthode

Returns the country ID for an IP Address.
public countryIdByAddr ( string $addr ) : integer
$addr string The IP Address.
Résultat integer The GeoIP country ID.

countryIdByName() public méthode

Returns the country ID for a hostname.
public countryIdByName ( string $name ) : integer
$name string The hostname.
Résultat integer The GeoIP country ID.

countryNameByAddr() public méthode

Returns the country name for an IP address.
public countryNameByAddr ( string $addr ) : mixed
$addr string The IP address.
Résultat mixed The country name.

countryNameByName() public méthode

Returns the country name for a hostname.
public countryNameByName ( string $name ) : integer
$name string The hostname.
Résultat integer The country name.

getCountryInfo() public méthode

Returns the country ID and Name for a given hostname.
public getCountryInfo ( string $name ) : mixed
$name string The hostname.
Résultat mixed An array with 'code' as the country code and 'name' as the country name, or false if not found.

Property Details

$_countryCodes protected_oe property

Country list.
protected array $_countryCodes
Résultat array

$_datafile protected_oe property

The location of the GeoIP database.
protected string $_datafile
Résultat string

$_fh protected_oe property

The open filehandle to the GeoIP database.
protected resource $_fh
Résultat resource