Updated for v2.0.1

This commit is contained in:
Gregory Oschwald 2014-10-28 14:20:50 -07:00
parent cf68b88021
commit b6c01c8eef

View File

@ -2,7 +2,7 @@
layout: default layout: default
title: MaxMind GeoIP2 PHP API title: MaxMind GeoIP2 PHP API
language: php language: php
version: v2.0.0 version: v2.0.1
--- ---
# GeoIP2 PHP API # # GeoIP2 PHP API #
@ -121,6 +121,24 @@ print($record->location->longitude . "\n"); // -93.2323
``` ```
### Anonymoous-IP Example ###
```php
<?php
require_once 'vendor/autoload.php';
use GeoIp2\Database\Reader;
// This creates the Reader object, which should be reused across
// lookups.
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Anonymous-IP.mmdb');
$record = $reader->anonymousIp('128.101.101.101');
if ($record->isAnonymous) { print "anon\n"; }
print($record->ipAddress . "\n"); // '128.101.101.101'
```
### Connection-Type Example ### ### Connection-Type Example ###
```php ```php
@ -245,9 +263,6 @@ for details on what data each end point may return.
The only piece of data which is always returned is the `ipAddress` The only piece of data which is always returned is the `ipAddress`
attribute in the `GeoIp2\Record\Traits` record. attribute in the `GeoIp2\Record\Traits` record.
Every record class attribute has a corresponding predicate method so you can
check to see if the attribute is set.
## Integration with GeoNames ## ## Integration with GeoNames ##
[GeoNames](http://www.geonames.org/) offers web services and downloadable [GeoNames](http://www.geonames.org/) offers web services and downloadable