From 3406489d72991101136b84c7070ed851ca72df5f Mon Sep 17 00:00:00 2001 From: dlage Date: Sat, 1 Jun 2013 16:32:50 +0200 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 442c882..a3a608b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Installation of the component: * Extract the release file under `protected/extensions` * Change main.php configuration file - +```php 'components' => array( ... 'geoip' => array( @@ -20,22 +20,22 @@ Installation of the component: ), ... ), - +``` Usage instructions: ------------------------ All methods accept an IP address as an argument. If no argument is supplied CHttpRequest::getUserHostAddress() is used. - +```php $location = Yii::app()->geoip->lookupLocation(); $countryCode = Yii::app()->geoip->lookupCountryCode(); $countryName = Yii::app()->geoip->lookupCountryName(); $org = Yii::app()->geoip->lookupOrg(); $regionCode = Yii::app()->geoip->lookupRegion(); - +``` Location attributes: - +```php $location->countryCode $location->countryCode3 $location->countryName @@ -47,14 +47,14 @@ Location attributes: $location->longitude $location->areaCode $location->dmaCode - +``` How to update Maxmind Free DBs example: ------------------------ `updateGeoIP.sh` this script will only download if there is a new version of the database - +```bash cd /usr/local/share/GeoIP wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz @@ -63,6 +63,6 @@ this script will only download if there is a new version of the database gunzip -c GeoLiteCity.dat.gz > GeoLiteCity.dat gunzip -c GeoIP.dat.gz > GeoIP.dat gunzip -c GeoIPv6.dat.gz > GeoIPv6.dat - +``` * Setup a cron job to run this script monthly.