PHP Класс 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.
Автор: Michael Slusarz ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_countryCodes array Country list.
$_datafile string The location of the GeoIP database.
$_fh resource The open filehandle to the GeoIP database.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
_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.

Описание методов

__construct() публичный Метод

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

_getName() защищенный Метод

Given a 2-letter country code, returns a country string.
protected _getName ( string $code ) : string
$code string The country code.
Результат string The country string.

_open() защищенный Метод

Open the GeoIP database.
protected _open ( ) : boolean
Результат boolean False on error.

_seekCountry() защищенный Метод

Finds a country by IP Address in the GeoIP database.
protected _seekCountry ( string $ipnum ) : mixed
$ipnum string The IP Address to search for.
Результат mixed The country ID or false if not found.

countryCodeByAddr() публичный Метод

Returns the country abbreviation (2-letter) for an IP Address.
public countryCodeByAddr ( string $addr ) : integer
$addr string The IP Address.
Результат integer The country abbreviation.

countryCodeByName() публичный Метод

Returns the country abbreviation (2-letter) for a hostname.
public countryCodeByName ( string $name ) : integer
$name string The hostname.
Результат integer The country abbreviation.

countryIdByAddr() публичный Метод

Returns the country ID for an IP Address.
public countryIdByAddr ( string $addr ) : integer
$addr string The IP Address.
Результат integer The GeoIP country ID.

countryIdByName() публичный Метод

Returns the country ID for a hostname.
public countryIdByName ( string $name ) : integer
$name string The hostname.
Результат integer The GeoIP country ID.

countryNameByAddr() публичный Метод

Returns the country name for an IP address.
public countryNameByAddr ( string $addr ) : mixed
$addr string The IP address.
Результат mixed The country name.

countryNameByName() публичный Метод

Returns the country name for a hostname.
public countryNameByName ( string $name ) : integer
$name string The hostname.
Результат integer The country name.

getCountryInfo() публичный Метод

Returns the country ID and Name for a given hostname.
public getCountryInfo ( string $name ) : mixed
$name string The hostname.
Результат mixed An array with 'code' as the country code and 'name' as the country name, or false if not found.

Описание свойств

$_countryCodes защищенное свойство

Country list.
protected array $_countryCodes
Результат array

$_datafile защищенное свойство

The location of the GeoIP database.
protected string $_datafile
Результат string

$_fh защищенное свойство

The open filehandle to the GeoIP database.
protected resource $_fh
Результат resource