Ver Mensaje Individual
  #11 (permalink)  
Antiguo 03/05/2014, 11:53
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Respuesta: Saber la provincia que visita mi página web.

Cita:
Iniciado por Italico76 Ver Mensaje
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
  1. #!/usr/bin/php -q
  2. <?php
  3.  
  4. // This code demonstrates how to lookup the country, region, city,
  5. // postal code, latitude, and longitude by IP Address.
  6. // It is designed to work with GeoIP/GeoLite City
  7.  
  8. // Note that you must download the New Format of GeoIP City (GEO-133).
  9. // The old format (GEO-132) will not work.
  10.  
  11. include("geoipcity.inc");
  12. include("geoipregionvars.php");
  13.  
  14. // uncomment for Shared Memory support
  15. // geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat");
  16. // $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY);
  17.  
  18. $gi = geoip_open("/usr/local/share/GeoIP/GeoLiteCityv6.dat",GEOIP_STANDARD);
  19.  
  20. $record = geoip_record_by_addr_v6($gi,"::24.24.24.24");
  21. print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "\n";
  22. print $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "\n";
  23. print $record->city . "\n";
  24. print $record->postal_code . "\n";
  25. print $record->latitude . "\n";
  26. print $record->longitude . "\n";
  27. print $record->metro_code . "\n";
  28. print $record->area_code . "\n";
  29. print $record->continent_code . "\n";
  30.  
  31. geoip_close($gi);
  32.  
  33. ?>

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
  1. <?php
  2.  
  3. include("include/geoipcity.inc");
  4. include("include/geoipregionvars.php");
  5.  
  6.  
  7.  
  8. $giCity = geoip_open("include/GeoLiteCity.dat",GEOIP_STANDARD);
  9.  
  10. $ip = $_SERVER["REMOTE_ADDR"];
  11.  
  12. $record = geoip_record_by_addr($giCity, $ip);
  13.  
  14. echo "Getting Country and City detail by IP Address <br /><br />";
  15.  
  16. echo "IP: " . $ip . "<br /><br />";
  17.  
  18. echo "Country Code: " . $record->country_code .  "<br />" .
  19.      "Country Code3: " . $record->country_code . "<br />" .
  20.      "Country Name: " . $record->country_name . "<br />" .
  21.      "Region Code: " . $record->region . "<br />" .
  22.      "Region Name: " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "<br />" .
  23.      "City: " . $record->city . "<br />" .
  24.      "Postal Code: " . $record->postal_code . "<br />" .
  25.      "Latitude: " . $record->latitude . "<br />" .
  26.      "Longitude: " . $record->longitude . "<br />" .
  27.      "Metro Code: " . $record->metro_code . "<br />" .
  28.      "Area Code: " . $record->area_code . "<br />" ;
  29.  
  30. geoip_close($giCity);
  31.  
  32.  
  33. ?>