Chinaunix首页 | 论坛 | 博客
  • 博客访问: 560184
  • 博文数量: 166
  • 博客积分: 4038
  • 博客等级: 上校
  • 技术积分: 1115
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-14 23:29
文章分类

全部博文(166)

文章存档

2010年(12)

2009年(126)

2008年(28)

分类: LINUX

2008-12-02 23:10:34

一个IP查询的API网站
PHP使用例子:

There are three methods of querying the GeoIP databases from PHP. The easiest to setup is the Pure PHP API. The setup for the high performance PHP extension and mod_geoip APIs is more advanced.

Pure PHP module
pure PHP module. Free and databases are available.

A port to PHP5 of the PHP API is available from .

The Pure PHP API is cross-platform, works on Windows as well as Linux, and does not require Apache, nor does it require the C API.

PHP Extension on PECL
a PHP extension that allows you to embed the inside PHP for improved performance.

Using mod_geoip with PHP
For improved performance, you can access the mod_geoip from PHP. There is a trade-off between performance and ease of installation - the Apache module is faster (), but the pure PHP module is much easier to install.

The following must be installed to use mod_geoip from PHP.

  • web server

Usage
Once is installed, it is easy to use from PHP. Use something like the following:

<%
$country_code = apache_note("GEOIP_COUNTRY_CODE");
$country_name = apache_note("GEOIP_COUNTRY_NAME");
%>

阅读(534) | 评论(0) | 转发(0) |
0

上一篇:apache优化

下一篇:常用shell命令

给主人留下些什么吧!~~