610 lines
14 KiB
HTML
610 lines
14 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
|
||
|
<title>Class GeoIp2\Database\Reader | GeoIP2 PHP API v2.1.0</title>
|
||
|
|
||
|
<link rel="stylesheet" href="resources/style.css?1648332946">
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id="left">
|
||
|
<div id="menu">
|
||
|
<a href="index.html" title="Overview"><span>Overview</span></a>
|
||
|
|
||
|
|
||
|
<div id="groups">
|
||
|
<h3>Namespaces</h3>
|
||
|
<ul>
|
||
|
<li class="active"><a href="namespace-GeoIp2.html">GeoIp2<span></span></a>
|
||
|
<ul>
|
||
|
<li class="active"><a href="namespace-GeoIp2.Database.html">Database</a>
|
||
|
</li>
|
||
|
<li><a href="namespace-GeoIp2.Exception.html">Exception</a>
|
||
|
</li>
|
||
|
<li><a href="namespace-GeoIp2.Model.html">Model</a>
|
||
|
</li>
|
||
|
<li><a href="namespace-GeoIp2.Record.html">Record</a>
|
||
|
</li>
|
||
|
<li><a href="namespace-GeoIp2.WebService.html">WebService</a>
|
||
|
</li>
|
||
|
</ul></li>
|
||
|
<li><a href="namespace-PHP.html">PHP</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<hr>
|
||
|
|
||
|
|
||
|
<div id="elements">
|
||
|
<h3>Classes</h3>
|
||
|
<ul>
|
||
|
<li class="active"><a href="class-GeoIp2.Database.Reader.html">Reader</a></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="splitter"></div>
|
||
|
|
||
|
<div id="right">
|
||
|
<div id="rightInner">
|
||
|
<form id="search">
|
||
|
<input type="hidden" name="cx" value="">
|
||
|
<input type="hidden" name="ie" value="UTF-8">
|
||
|
<input type="text" name="q" class="text" placeholder="Search">
|
||
|
</form>
|
||
|
|
||
|
<div id="navigation">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="index.html" title="Overview"><span>Overview</span></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="namespace-GeoIp2.Database.html" title="Summary of GeoIp2\Database"><span>Namespace</span></a>
|
||
|
</li>
|
||
|
<li class="active">
|
||
|
<span>Class</span> </li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<div id="content" class="class">
|
||
|
<h1>Class Reader</h1>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
<p>Instances of this class provide a reader for the GeoIP2 database format.
|
||
|
IP addresses can be looked up using the database specific methods.</p>
|
||
|
|
||
|
<h2>Usage</h2>
|
||
|
|
||
|
<p>The basic API for this class is the same for every database. First, you
|
||
|
create a reader object, specifying a file name. You then call the method
|
||
|
corresponding to the specific database, passing it the IP address you want
|
||
|
to look up.</p>
|
||
|
|
||
|
<p>If the request succeeds, the method call will return a model class for
|
||
|
the method you called. This model in turn contains multiple record classes,
|
||
|
each of which represents part of the data returned by the database. If
|
||
|
the database does not contain the requested information, the attributes
|
||
|
on the record class will have a <code>null</code> value.</p>
|
||
|
|
||
|
<p>If the address is not in the database, an
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code> exception will be
|
||
|
thrown. If an invalid IP address is passed to one of the methods, a
|
||
|
SPL <code><a href="class-InvalidArgumentException.html">InvalidArgumentException</a></code> will be thrown. If the database is
|
||
|
corrupt or invalid, a \MaxMind\Db\Reader\InvalidDatabaseException
|
||
|
will be thrown.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<dl class="tree">
|
||
|
<dd style="padding-left:0px">
|
||
|
<b><span>GeoIp2\Database\Reader</span></b>
|
||
|
implements
|
||
|
<a href="class-GeoIp2.ProviderInterface.html"><span>GeoIp2\ProviderInterface</span></a>
|
||
|
|
||
|
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="info">
|
||
|
|
||
|
|
||
|
<b>Namespace:</b> GeoIp2\Database<br>
|
||
|
|
||
|
|
||
|
<b>Located at</b> <a href="source-class-GeoIp2.Database.Reader.html#9-229" title="Go to source code">GeoIp2/Database/Reader.php</a><br>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<table class="summary methods" id="methods">
|
||
|
<caption>Methods summary</caption>
|
||
|
<tr data-order="__construct" id="___construct">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#___construct">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#39-54" title="Go to source code">__construct</a>( <span>string <var>$filename</var></span>, <span>array <var>$locales</var> = <span class="php-keyword1">array</span>(<span class="php-quote">'en'</span>) </span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>Constructor.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>Constructor.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$filename</var></dt>
|
||
|
<dd>The path to the GeoIP2 database file.
|
||
|
</dd>
|
||
|
<dt><var>$locales</var></dt>
|
||
|
<dd><p>List of locale codes to use in name property
|
||
|
from most preferred to least preferred.</p>
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="city" id="_city">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.City.html">GeoIp2\Model\City</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_city">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#56-71" title="Go to source code">city</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 City model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 City model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.City.html">GeoIp2\Model\City</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Implementation of</h4>
|
||
|
<div class="list"><code><a href="class-GeoIp2.ProviderInterface.html#_city">GeoIp2\ProviderInterface::city()</a></code></div>
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="country" id="_country">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.Country.html">GeoIp2\Model\Country</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_country">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#73-88" title="Go to source code">country</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 Country model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 Country model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.Country.html">GeoIp2\Model\Country</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Implementation of</h4>
|
||
|
<div class="list"><code><a href="class-GeoIp2.ProviderInterface.html#_country">GeoIp2\ProviderInterface::country()</a></code></div>
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="anonymousIp" id="_anonymousIp">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.AnonymousIp.html">GeoIp2\Model\AnonymousIp</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_anonymousIp">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#90-109" title="Go to source code">anonymousIp</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 Anonymous IP model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 Anonymous IP model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.AnonymousIp.html">GeoIp2\Model\AnonymousIp</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="connectionType" id="_connectionType">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.ConnectionType.html">GeoIp2\Model\ConnectionType</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_connectionType">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#111-130" title="Go to source code">connectionType</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 Connection Type model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 Connection Type model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.ConnectionType.html">GeoIp2\Model\ConnectionType</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="domain" id="_domain">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.Domain.html">GeoIp2\Model\Domain</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_domain">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#132-151" title="Go to source code">domain</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 Domain model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 Domain model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.Domain.html">GeoIp2\Model\Domain</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="isp" id="_isp">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
<code><a href="class-GeoIp2.Model.Isp.html">GeoIp2\Model\Isp</a></code>
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_isp">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#153-172" title="Go to source code">isp</a>( <span>string <var>$ipAddress</var></span> )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>This method returns a GeoIP2 ISP model.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>This method returns a GeoIP2 ISP model.</p>
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Parameters</h4>
|
||
|
<div class="list"><dl>
|
||
|
<dt><var>$ipAddress</var></dt>
|
||
|
<dd>IPv4 or IPv6 address as a string.
|
||
|
</dd>
|
||
|
</dl></div>
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code><code><a href="class-GeoIp2.Model.Isp.html">GeoIp2\Model\Isp</a></code></code>
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-GeoIp2.Exception.AddressNotFoundException.html">GeoIp2\Exception\AddressNotFoundException</a></code><br><p>if the address is
|
||
|
not in the database.</p>
|
||
|
<br>
|
||
|
MaxMind\Db\Reader\InvalidDatabaseException<br><p>if the database
|
||
|
is corrupt or invalid</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="metadata" id="_metadata">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
MaxMind\Db\Reader\Metadata
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_metadata">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#212-220" title="Go to source code">metadata</a>( )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<h4>Returns</h4>
|
||
|
<div class="list">
|
||
|
<code>MaxMind\Db\Reader\Metadata</code><br>object for the database.
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<h4>Throws</h4>
|
||
|
<div class="list">
|
||
|
<code><a href="class-InvalidArgumentException.html">InvalidArgumentException</a></code><br>if arguments are passed to the method.
|
||
|
<br>
|
||
|
<code><a href="class-BadMethodCallException.html">BadMethodCallException</a></code><br>if the database has been closed.
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
<tr data-order="close" id="_close">
|
||
|
|
||
|
<td class="attributes"><code>
|
||
|
public
|
||
|
|
||
|
|
||
|
|
||
|
</code>
|
||
|
</td>
|
||
|
|
||
|
<td class="name"><div>
|
||
|
<a class="anchor" href="#_close">#</a>
|
||
|
<code><a href="source-class-GeoIp2.Database.Reader.html#222-228" title="Go to source code">close</a>( )</code>
|
||
|
|
||
|
<div class="description short">
|
||
|
<p>Closes the GeoIP2 database and returns the resources to the system.</p>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="description detailed hidden">
|
||
|
<p>Closes the GeoIP2 database and returns the resources to the system.</p>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="footer">
|
||
|
GeoIP2 PHP API v2.1.0 API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script src="resources/combined.js?721046668"></script>
|
||
|
<script src="elementlist.js?1983305385"></script>
|
||
|
</body>
|
||
|
</html>
|