XLVIII. GeoIP Functions

简介

The GeoIP extension allows you to find the location of an IP address. City, State, Country, Longitude, Latitude, and other information as all, such as ISP and connection type can be obtained with the help of GeoIP.

需求

This extension requires the GeoIP C library version 1.4.0 or higher to be installed. You can grab the latest version from http://www.maxmind.com/app/c and compile it yourself.

By default, you will only have access to the Free GeoIP Country or GeoLite City databases. While this module can work with other types of database, you must buy a commercial license from Maxmind.

安装

PECL 扩展未绑定于 PHP 中。

安装此 PECL 扩展库的信息可在手册中标题为 PECL 扩展库安装的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: http://pecl.php.net/package/geoip.

资源类型

本扩展模块未定义任何资源类型。

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

GEOIP_COUNTRY_EDITION (integer)

GEOIP_REGION_EDITION_REV0 (integer)

GEOIP_CITY_EDITION_REV0 (integer)

GEOIP_ORG_EDITION (integer)

GEOIP_ISP_EDITION (integer)

GEOIP_CITY_EDITION_REV1 (integer)

GEOIP_REGION_EDITION_REV1 (integer)

GEOIP_PROXY_EDITION (integer)

GEOIP_ASNUM_EDITION (integer)

GEOIP_NETSPEED_EDITION (integer)

GEOIP_DOMAIN_EDITION (integer)

The following constants are for net speed:

GEOIP_UNKNOWN_SPEED (integer)

GEOIP_DIALUP_SPEED (integer)

GEOIP_CABLEDSL_SPEED (integer)

GEOIP_CORPORATE_SPEED (integer)

目录
geoip_country_code_by_name -- Get the two letter country code
geoip_country_code3_by_name -- Get the three letter country code
geoip_country_name_by_name -- Get the full country name
geoip_database_info -- Get GeoIP Database information
geoip_id_by_name -- Get the Internet connection speed
geoip_org_by_name -- Get the organization name
geoip_record_by_name -- Returns the detailed City information found in the GeoIP Database
geoip_region_by_name -- Get the country code and region