Cita:
Iniciado por Italico76 Muy buena esa base datos! en fin..... habia buscado la documentacion para colaborarle al compañero y la deje donde no era.... pense algun moderador se daria cuenta y la moveria :P
Código PHP:
Ver original#!/usr/bin/php -q
<?php
// This code demonstrates how to lookup the country, region, city,
// postal code, latitude, and longitude by IP Address.
// It is designed to work with GeoIP/GeoLite City
// Note that you must download the New Format of GeoIP City (GEO-133).
// The old format (GEO-132) will not work.
include("geoipcity.inc");
include("geoipregionvars.php");
// uncomment for Shared Memory support
// geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat");
// $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY);
$gi = geoip_open("/usr/local/share/GeoIP/GeoLiteCityv6.dat",GEOIP_STANDARD);
$record = geoip_record_by_addr_v6($gi,"::24.24.24.24");
print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "\n";
print $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "\n";
print $record->city . "\n";
print $record->postal_code . "\n";
print $record->latitude . "\n";
print $record->longitude . "\n";
print $record->metro_code . "\n";
print $record->area_code . "\n";
print $record->continent_code . "\n";
geoip_close($gi);
?>
Sacado de MaxMind usando Google:
http://www.maxmind.com/download/geoi...le_city-v6.php http://dev.maxmind.com/geoip/legacy/install/country/
Posteado hace 1 dia en el
hilo equivocado Gracias, he hecho esto pero sigue sin darme la ciudad. Me da el pais, la ip, la longitud y la latitud.
Código Javascript
:
Ver original<?php
include("include/geoipcity.inc");
include("include/geoipregionvars.php");
$giCity = geoip_open("include/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);
?>