Advertisement
krot

geoip

Jun 29th, 2022 (edited)
999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. https://pecl.php.net/package/geoip/1.1.1/windows 7.4 Thread Safe (TS) x64
  2. https://www.miyuru.lk/geoiplegacy
  3. https://mailfud.org/geoip-legacy/
  4.  
  5. $record = geoip_record_by_name('www.example.com');
  6. if ($record) {
  7.     print_r($record);
  8. }
  9.  
  10. https://github.com/maxmind/geoip-api-php
  11.  
  12. require 'geoip-api-php-main/src/geoipcity.inc';
  13.  
  14.  
  15.  
  16. // uncomment for Shared Memory support
  17. // geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat");
  18. // $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY);
  19.  
  20. $gi = geoip_open("GeoIPCity.dat", GEOIP_STANDARD);
  21.  
  22. $record = GeoIP_record_by_addr($gi, "24.24.24.24");
  23. print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "\n";
  24. print $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "\n";
  25. print $record->city . "\n";
  26. print $record->postal_code . "\n";
  27. print $record->latitude . "\n";
  28. print $record->longitude . "\n";
  29. print $record->metro_code . "\n";
  30. print $record->area_code . "\n";
  31. print $record->continent_code . "\n";
  32.  
  33. geoip_close($gi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement