===========
GeoIP C API
===========
Download
open source GeoIP C API. includes a free GeoIP Country database. The code is licensed under the GPL, and commercial licenses are available.
(http://www.maxmind.com/download/geoip/api/c/)
Install
This API should work on most UNIX and GNU/Linux platforms.
./configure
make
make check
make install
For installing on Windows, see the READMEwin32.txt file supplied with the distribution.
Usage
This following sample codes looks up the country code by IP address:
#include <GeoIP.h>
int main (int argc, char *argv[]) {
GeoIP * gi;
gi = GeoIP_new(GEOIP_STANDARD);
printf("code %s\n",
GeoIP_country_code_by_name(gi, "yahoo.com"));
}
To compile this example, run gcc -lGeoIP example.c.
For additional examples, see test/test-geoip.c and apps/geoiplookup.c.
A FreeBSD Port is available from http://cvsweb.FreeBSD.org/ports/net/GeoIP/
==============
GeoIP Perl API
==============
Requirements
For Geo::IP, GeoIP C Library must be installed.
Note that Geo::IP::PurePerl is also available, which doesn't require the C Library and contains no XS code.
Download
Download Geo::IP Perl Module (faster, but requires C library)
Download Geo::IP::PurePerl Module (slower, but does not require C library)
(http://www.maxmind.com/download/geoip/api/perl)
Installing on Linux
This should work on most UNIX and GNU/Linux platforms.
perl Makefile.PL
make
make test
make install
More documentation is available from CPAN.
====
先安裝 GeoIP perl API 遇此問題:
[root@NICA Geo-IP-1.25]# perl Makefile.PL
GeoIP must be installed prior to building Geo::IP and I can't find
it in the standard library directories. You can download GeoIP from:
http://maxmind.com/geoip/api/c.shtml
If GeoIP is installed, but in a non-standard directory, then use the
following options to Makefile.PL:
perl Makefile.PL LIBS='-L/home/me/lib' INC='-I/home/me/include'
Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.
連結至 http://maxmind.com/geoip/api/c.shtml 先行安裝GeoIP C API,結果為:
[root@NICA Geo-IP-1.25]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Geo::IP
接下來
make
make test
make install
照作…
最後只要記得把 awstats.XXX.conf 裡的 Loadplugin geoip 打開即可
GeoIP C API
===========
Download
open source GeoIP C API. includes a free GeoIP Country database. The code is licensed under the GPL, and commercial licenses are available.
(http://www.maxmind.com/download/geoip/api/c/)
Install
This API should work on most UNIX and GNU/Linux platforms.
./configure
make
make check
make install
For installing on Windows, see the READMEwin32.txt file supplied with the distribution.
Usage
This following sample codes looks up the country code by IP address:
#include <GeoIP.h>
int main (int argc, char *argv[]) {
GeoIP * gi;
gi = GeoIP_new(GEOIP_STANDARD);
printf("code %s\n",
GeoIP_country_code_by_name(gi, "yahoo.com"));
}
To compile this example, run gcc -lGeoIP example.c.
For additional examples, see test/test-geoip.c and apps/geoiplookup.c.
A FreeBSD Port is available from http://cvsweb.FreeBSD.org/ports/net/GeoIP/
==============
GeoIP Perl API
==============
Requirements
For Geo::IP, GeoIP C Library must be installed.
Note that Geo::IP::PurePerl is also available, which doesn't require the C Library and contains no XS code.
Download
Download Geo::IP Perl Module (faster, but requires C library)
Download Geo::IP::PurePerl Module (slower, but does not require C library)
(http://www.maxmind.com/download/geoip/api/perl)
Installing on Linux
This should work on most UNIX and GNU/Linux platforms.
perl Makefile.PL
make
make test
make install
More documentation is available from CPAN.
====
先安裝 GeoIP perl API 遇此問題:
[root@NICA Geo-IP-1.25]# perl Makefile.PL
GeoIP must be installed prior to building Geo::IP and I can't find
it in the standard library directories. You can download GeoIP from:
http://maxmind.com/geoip/api/c.shtml
If GeoIP is installed, but in a non-standard directory, then use the
following options to Makefile.PL:
perl Makefile.PL LIBS='-L/home/me/lib' INC='-I/home/me/include'
Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.
連結至 http://maxmind.com/geoip/api/c.shtml 先行安裝GeoIP C API,結果為:
[root@NICA Geo-IP-1.25]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Geo::IP
接下來
make
make test
make install
照作…
最後只要記得把 awstats.XXX.conf 裡的 Loadplugin geoip 打開即可