QQWry/en
出自SurfLib
目录 |
description
This is a php extension written in C. By using this ext, you can get ip related location info from QQWry(chunzhen) Data file.It is 6-10 times fater than the native php version such as one from discuz and one from coolcode.
Only support PHP5 currently.
installation
- sudo pecl install qqwry-beta or Download directly,phpize && ./configure && make && sudo make install
- edit php.ini,add extension=qqwry.so
- restart http server
example
The iconv is used to convert charset.You may not use it.
$qqwry=new qqwry('QQWry.Dat');
list($addr1,$addr2)=$qqwry->q('127.0.0.1');
$addr1=iconv('GB2312','UTF-8',$addr1);
$addr2=iconv('GB2312','UTF-8',$addr2);
echo $addr1,'|',$addr2,"\n";
$arr=$qqwry->q('222.216.47.4');
$arr[0]=iconv('GB2312','UTF-8',$arr[0]);
$arr[1]=iconv('GB2312','UTF-8',$arr[1]);
echo $arr[0],'|',$arr[1],"\n";
$arr=$qqwry->q('64.233.187.99');
$arr[0]=iconv('GB2312','UTF-8',$arr[0]);
$arr[1]=iconv('GB2312','UTF-8',$arr[1]);
echo $arr[0],'|',$arr[1],"\n";
output:
本机地址| 广西南宁市|(青秀区)电信ADSL 美国|加利福尼亚州Google公司
others
The latest QQWry data file can be found on http://www.cz88.net/.


