Location Detection Via IP Address
- March 30th, 2012
- By ochyid
- Write comment
Lama tidak nulis di blog ![]()
Mau berbagi karena dapet ilmu baru dari Googling Untuk deteksi Lokasi berdasarkan IP Address ada banyak cara salah satunya dengan GeoIPCity
Database versi lite dari GeoIPCity bisa di download di sini
untuk penggunaan scriptnya bisa diliat pada code sniplet dibawah ini :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?php /** * Querying against GeoIP/Lite City * This will fetch country along with city information */ include("geoipcity.inc"); include("geoipregionvars.php"); $giCity = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD); $ip =$_SERVER['REMOTE_ADDR']; $record = geoip_record_by_addr($giCity, $ip); echo "Getting Country and City detail by IP Address <br /><br />"; echo "IP: " . $ip . "<br /><br />"; echo "Country Code: " . $record->country_code . "<br />" . "Country Code3: " . $record->country_code . "<br />" . "Country Name: " . $record->country_name . "<br />" . "Region Code: " . $record->region . "<br />" . "Region Name: " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "<br />" . "City: " . $record->city . "<br />" . "Postal Code: " . $record->postal_code . "<br />" . "Latitude: " . $record->latitude . "<br />" . "Longitude: " . $record->longitude . "<br />" . "Metro Code: " . $record->metro_code . "<br />" . "Area Code: " . $record->area_code . "<br />" ; geoip_close($giCity); ?> |
Nah silahkan di coba…jika ingin cara yang paling mudah dan instan tunggu postingan berikutnya ya
Sumber Geo IP









