-
Notifications
You must be signed in to change notification settings - Fork 2
InstallationAndUsage
dlage edited this page Jun 1, 2013
·
1 revision
- summary Installation and Usage instructions
- Yii 1.0 or above (tested with Yii 1.1.3 but should work with previous versions)
- Extract the release file under `protected/extensions`
- Change main.php configuration file
'components' => array( ... 'geoip' => array( 'class' => 'application.extensions.geoip.CGeoIP', // specify filename location for the corresponding database 'filename' => 'C:\path\to\GeoIP\GeoLiteCity.dat', // Choose MEMORY_CACHE or STANDARD mode 'mode' => 'STANDARD', ), ... ),
See the following code example:
$location = Yii::app()->geoip->lookupLocation(); // with IP in google.com $location = Yii::app()->geoip->lookupLocation('209.85.135.104'); $countryCode = Yii::app()->geoip->lookupCountryCode(); $countryName = Yii::app()->geoip->lookupCountryName(); $org = Yii::app()->geoip->lookupOrg(); $regionCode = Yii::app()->geoip->lookupRegion(); // Location attributes: $location->countryCode $location->countryCode3 $location->countryName $location->region $location->regionName $location->city $location->postalCode $location->latitude $location->longitude $location->areaCode $location->dmaCode