Untuk mengetahui negara asal IP address pengunjung website, kita bisa menggunakan beberapa metode dalam PHP.
Yang paling mudah adalah menggunakan versi pure PHP.
Kamu harus download dulu geoip free country file dan mengekstrak di direktori tertentu di website kamu.
Jika sudah, berikut adalah contoh kodenya, untuk melihat penjelasan detil, silakan ke website ini :
Yang paling mudah adalah menggunakan versi pure PHP.
Kamu harus download dulu geoip free country file dan mengekstrak di direktori tertentu di website kamu.
Jika sudah, berikut adalah contoh kodenya, untuk melihat penjelasan detil, silakan ke website ini :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| <?php// include functionsinclude("geoip.inc");// read GeoIP database$handle = geoip_open("GeoIP.dat", GEOIP_STANDARD);// map IP to countryecho "IP address 62.149.130.132 located in " . geoip_country_name_by_addr($handle, "62.149.130.132") . " (country code " . geoip_country_code_by_addr($handle, "62.149.130.132") . ")";// close database handlergeoip_close($handle);// print compulsory license noticeecho "<p> -- This product includes GeoIP data created by MaxMind, available from http://maxmind.com/ --";?> |

0 comments:
Post a Comment