From 3b4ccf3e7087cb51b9183c2e36890b4d82058544 Mon Sep 17 00:00:00 2001 From: dlage Date: Sat, 1 Jun 2013 16:30:40 +0200 Subject: [PATCH] Update README.md --- README.md | 93 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index ac3698e..442c882 100644 --- a/README.md +++ b/README.md @@ -4,60 +4,65 @@ yii-geoip Yii Module to allow for easy usage of the MaxMind Free dbs. Installation of the component: +------------------------ * 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', - ), - ... - ), ------------------------------------------------ + + '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', + ), + ... + ), + + Usage instructions: +------------------------ All methods accept an IP address as an argument. If no argument is supplied CHttpRequest::getUserHostAddress() is used. -` - $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 = 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: -` - $location->countryCode - $location->countryCode3 - $location->countryName - $location->region - $location->regionName - $location->city - $location->postalCode - $location->latitude - $location->longitude - $location->areaCode - $location->dmaCode -` ------------------------------------------------ + $location->countryCode + $location->countryCode3 + $location->countryName + $location->region + $location->regionName + $location->city + $location->postalCode + $location->latitude + $location->longitude + $location->areaCode + $location->dmaCode + + + How to update Maxmind Free DBs example: -updateGeoIP.sh +------------------------ +`updateGeoIP.sh` this script will only download if there is a new version of the database -` - 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 - wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz - gunzip -c GeoLiteCity.dat.gz > GeoLiteCity.dat - gunzip -c GeoIP.dat.gz > GeoIP.dat - gunzip -c GeoIPv6.dat.gz > GeoIPv6.dat -` + 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 + wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz + + 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. + +* Setup a cron job to run this script monthly.