creatorasebo.blogg.se

Maxmind ip database
Maxmind ip database





maxmind ip database

This means that if you don't explicitly catch errors they will ultimately be sent to STDERR with some sort of (hopefully) useful error message. This error class has an $error->message() method and overload stringification to show that message. In the case of a fatal error, the reader will throw a GeoIP2::Error::Generic or GeoIP2::Error::IPAddressNotFound exception object. This method returns a MaxMind::DB::Metadata object containing information about the database. This method returns a GeoIP2::Model::AnonymousIP object. This method returns a GeoIP2::Model::Enterprise object. This method returns a GeoIP2::Model::ISP object. This method returns a GeoIP2::Model::Domain object. This method returns a GeoIP2::Model::City object. This method returns a GeoIP2::Model::Country object. This method returns a GeoIP2::Model::ConnectionType object. This method returns a GeoIP2::Model::ASN object. Unlike the web service client class, you cannot pass the string "me" as your ip address. This is the address that you want to look up using the GeoIP2 web service.

maxmind ip database

This must be a valid IPv4 or IPv6 address. Īll of the request methods accept a single argument:

maxmind ip database

#Maxmind ip database code#

Passing any other locale code will result in an error. In other words, English does not mean ASCII. If you do not include this locale, the name() method may end up returning undef even when the record in question has an English name.Ĭurrently, the valid list of locale codes is:Įnglish names may still include accented characters if that is the accepted spelling in English. Note that the only locale which is always present in the GeoIP2 data in "en". When a record class has multiple names (country, city, etc.), its name() method will look at each element of this array ref and return the first locale for which it has a name. This argument will be passed on to record classes to use when their name() methods are called. This is an array reference where each value is a string indicating a locale. This is the path to the GeoIP2 database which you'd like to query. This class has a single constructor method: GeoIP2::Database::Reader->new()

maxmind ip database

Any location provided by a GeoIP2 database should not be used to identify a particular address or household. Locations are often near the center of the population. If the database cannot be read, the reader class throws an exception. If the request succeeds, the method call will return a model class for the method point you called. Then you call the method corresponding to your database type, passing it the IP address you want to look up. First you create a database reader object with your file and locale params. The basic API for this class is the same for all database types. If the database does not return a particular piece of data for an IP address, the associated attribute is not populated. Each method returns a different model class. This class provides a reader API for all GeoIP2 databases. Print $country->iso_code(), "\n" DESCRIPTION My $reader = GeoIP2::Database::Reader->new(įile => '/path/to/database', # e.g. GeoIP2::Database::Reader - Perl API for GeoIP2 databases VERSION







Maxmind ip database