sample.php 550 B

1234567891011121314151617181920
  1. #!/usr/bin/php -q
  2. <?php
  3. // This code demonstrates how to lookup the country by IP Address
  4. include("geoip.inc");
  5. // Uncomment if querying against GeoIP/Lite City.
  6. // include("geoipcity.inc");
  7. $gi = geoip_open("/usr/local/share/GeoIP/GeoIP.dat",GEOIP_STANDARD);
  8. echo geoip_country_code_by_addr($gi, "24.24.24.24") . "\t" .
  9. geoip_country_name_by_addr($gi, "24.24.24.24") . "\n";
  10. echo geoip_country_code_by_addr($gi, "80.24.24.24") . "\t" .
  11. geoip_country_name_by_addr($gi, "80.24.24.24") . "\n";
  12. geoip_close($gi);
  13. ?>