Added some comments in examples

This commit is contained in:
Gregory Oschwald 2013-09-19 07:52:44 -07:00
parent decfda7e90
commit c642a32b0c

View File

@ -81,7 +81,12 @@ See the API documentation for more details.
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
use \GeoIp2\Database\Reader; use \GeoIp2\Database\Reader;
// This creates the Reader object, which should be reused across
// lookups.
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb'); $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
// Replace "city" with the appropriate method for your database, e.g.,
// "country".
$record = $reader->city('128.101.101.101'); $record = $reader->city('128.101.101.101');
print($record->country->isoCode . "\n"); // 'US' print($record->country->isoCode . "\n"); // 'US'
@ -124,7 +129,11 @@ See the API documentation for more details.
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
use \GeoIp2\WebService\Client; use \GeoIp2\WebService\Client;
// This creates a Client object that can be reused across requests.
$client = new Client(42, 'abcdef123456'); $client = new Client(42, 'abcdef123456');
// Replace "city" with the method corresponding to the web service that
// you are using, e.g., "country", "cityIspOrg", "omni".
$record = $client->city('128.101.101.101'); $record = $client->city('128.101.101.101');
print($record->country->isoCode . "\n"); // 'US' print($record->country->isoCode . "\n"); // 'US'