PHP Classes

File: vendor/geoip/geoip/examples/region.php

Recommend this page to a friend!
  Classes of Ganesh Kandu   kchat   vendor/geoip/geoip/examples/region.php   Download  
File: vendor/geoip/geoip/examples/region.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: kchat
Database driven PHP live chat system
Author: By
Last change:
Date: 6 years ago
Size: 840 bytes
 

Contents

Class file image Download
#!/usr/bin/php -q
<?php

// This code demonstrates how to lookup the country and region by IP Address
// It is designed to work with GeoIP Region available from MaxMind

include("../src/geoip.inc");
include(
"../src/geoipregionvars.php");

$gi = geoip_open("/usr/local/share/GeoIP/GeoIPRegion.dat", GEOIP_STANDARD);

list (
$countrycode, $region) = geoip_region_by_addr($gi, "24.24.24.24");
print
$countrycode . " " . $region . " " . $GEOIP_REGION_NAME[$countrycode][$region] . "\n";
list (
$countrycode, $region) = geoip_region_by_addr($gi, "80.24.24.24");
print
$countrycode . " " . $region . " " . $GEOIP_REGION_NAME[$countrycode][$region] . "\n";
list (
$countrycode, $region) = geoip_region_by_addr($gi, "199.243.137.184");
print
$countrycode . " " . $region . " " . $GEOIP_REGION_NAME[$countrycode][$region] . "\n";
geoip_close($gi);

?>