Maxmind geoip api iso#
Source things like place names, ISO codes, and other similar data from Some of the data that MaxMind provides is also sourced from GeoNames. (city, region, country, etc.) in the GeoNames database. Many of the records returned by the GeoIP2 web services and databases Eachįeature is unique identified by a geonameId, which is an integer.
Maxmind geoip api free#
They offer both free and paid premium data. GeoNames offers web services and downloadableĭatabases with data on geographical features around the world, including The only piece of data which is always returned is the ipAddressĪttribute in the GeoIp2\Record\Traits record. Where some or all of the attributes are unpopulated.įor details on what data each end point may return. Point may offer a particular piece of data, MaxMind does not always have everyīecause of these factors, it is possible for any end point to return a record Which can be populated vary between end points. While many of the end points return the same basic records, the attributes GeoIp2\Record\Subdivision - $subdivision->isoCode or $subdivision->geonameId.GeoIp2\Record\Country and GeoIp2\Record\RepresentedCountry.GeoIp2\Record\Continent - $continent->code or $continent->geonameId.We strongly discourage you from using a value from any names property as " \n " ) // 'Minneapolis' print ( $record -> postal -> code. " \n " ) // 'MN' print ( $record -> city -> name. " \n " ) // 'Minnesota' print ( $record -> mostSpecificSubdivision -> isoCode. " \n " ) // '美国' print ( $record -> mostSpecificSubdivision -> name. " \n " ) // 'United States' print ( $record -> country -> names. " \n " ) // 'US' print ( $record -> country -> name. " \n " ) // 50 print ( $record -> location -> latitude. " \n " ) // '55455' print ( $record -> location -> accuracyRadius. " \n " ) // 60 print ( $record -> city -> name. " \n " ) // 'MN' print ( $record -> city -> confidence. " \n " ) // 77 print ( $record -> mostSpecificSubdivision -> name. " \n " ) // '美国' print ( $record -> mostSpecificSubdivision -> confidence. " \n " ) // 99 print ( $record -> country -> isoCode. " \n " ) // '128.101.101.101/32' Anonymous IP ExampleĮnterprise method to do a lookup in the Enterprise database $record = $reader -> enterprise ( '128.101.101.101' ) print ( $record -> country -> confidence.
See the API documentation for more details.
\MaxMind\Db\InvalidDatabaseException will be thrown. If the record is not found, a \GeoIp2\Exception\AddressNotFoundException This model in turn contains multiple containerĬlasses for the different parts of the data such as the city in which the If the lookup succeeds, the method call will return a model class for the May then call the method corresponding to the database you are using. The path to the database file as the first argument to the constructor. To use this API, you must create a new \GeoIp2\Database\Reader object with Should not be used to identify a particular address or household. Any location provided by a GeoIP2 database or web service
The extension has no effect on web-service lookups. To install, pleaseįollow the instructions included with that API. The performance of lookups in GeoIP2 or GeoLite2 databases.
Maxmind geoip api install#
Includes an optional C extension that you may install to dramatically increase Require 'geoip2.phar' Optional C Extension