timeline: if a section is set to hidden and the user is not capable of editing a...
[moodle-blog-course-format.git] / lib / geoip / README.htm
blob8456d2b0e350872f4b788b5187bbb8704aa15bd2
1 Requirements
3 None (only the 'GeoIP.dat' file is needed). To download a free GeoIP Standard Country
4 database, go to
5 http://maxmind.com/download/geoip/database/
7 Install
9 Just place the 'geoip.inc' file somewhere according to the 'include_path' directive of
10 your 'php.ini' file, or just place it in the same directory as your PHP scripts.
12 Usage
14 Gets country name by hostname :
16 include("geoip.inc");
18 $gi = geoip_open("/usr/local/share/GeoIP/GeoIP.dat",GEOIP_STANDARD);
20 echo geoip_country_code_by_addr($gi, "24.24.24.24") . "\t" .
21 geoip_country_name_by_addr($gi, "24.24.24.24") . "\n";
22 echo geoip_country_code_by_addr($gi, "80.24.24.24") . "\t" .
23 geoip_country_name_by_addr($gi, "80.24.24.24") . "\n";
25 geoip_close($gi);
27 Memory Caching:
28 To enable memory caching, pass GEOIP_SHARED_MEMORY or
29 GEOIP_MEMORY_CACHE to the second argument of geoip_open
31 For GEOIP_SHARED_MEMORY, requires php >= 4.0.4,
32 and --enable-shmop passed at configure time, see
33 http://us2.php.net/manual/en/ref.shmop.php
34 In addition, you should call geoip_load_shared_mem
35 before calling geoip_open. See sample_city.php for an
36 example of shared memory caching.
38 Working with PHP5.
39 geoip_country_code_by_addr should work
40 with PHP. For help with the other
41 routines, please contact support@maxmind.com
43 Thanks to Jim Winstead.