Initial revision for PECL GeoIP documentation

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@218685 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Olivier Hill 2006-08-22 18:57:07 +00:00
parent 7043a53267
commit 5640fb2f62
10 changed files with 1178 additions and 0 deletions

View file

@ -0,0 +1,191 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<section id="geoip.constants">
&reftitle.constants;
&extension.constants;
<variablelist>
<varlistentry>
<term>
<constant>GEOIP_COUNTRY_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_REGION_EDITION_REV0</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_CITY_EDITION_REV0</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_ORG_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_ISP_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_CITY_EDITION_REV1</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_REGION_EDITION_REV1</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_PROXY_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_ASNUM_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_NETSPEED_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_DOMAIN_EDITION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
The following constants are for net speed:
</para>
<variablelist>
<varlistentry>
<term>
<constant>GEOIP_UNKNOWN_SPEED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara></simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_DIALUP_SPEED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara></simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_CABLEDSL_SPEED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara></simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GEOIP_CORPORATE_SPEED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara></simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-country-code-by-name">
<refnamediv>
<refname>geoip_country_code_by_name</refname>
<refpurpose>Get the two letter country code</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>geoip_country_code_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_country_code_by_name</function> function will return
the two letter country code corresponding to a hostname or an IP address.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose location is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the two letter ISO country code on success, or &false;
if the address cannot be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_country_code_by_name</function> example</title>
<para>
This will print where the host example.com is located.
</para>
<programlisting role="php">
<![CDATA[
<?php
$country = geoip_country_code_by_name('www.example.com');
if ($country) {
echo 'This host is located in: ' . $country;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
This host is located in: US
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>geoip_country_code3_by_name</function></member>
<member><function>geoip_country_name_by_name</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-country-code3-by-name">
<refnamediv>
<refname>geoip_country_code3_by_name</refname>
<refpurpose>Get the three letter country code</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>geoip_country_code3_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_country_code3_by_name</function> function will return the
three letter country code corresponding to a hostname or an IP address.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose location is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the three letter country code on success, or &false;
if the address cannot be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_country_code3_by_name</function> example</title>
<para>
This will print where the host example.com is located.
</para>
<programlisting role="php">
<![CDATA[
<?php
$country = geoip_country_code3_by_name('www.example.com');
if ($country) {
echo 'This host is located in: ' . $country;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
This host is located in: USA
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>geoip_country_code_by_name</function></member>
<member><function>geoip_country_name_by_name</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-country-name-by-name">
<refnamediv>
<refname>geoip_country_name_by_name</refname>
<refpurpose>Get the full country name</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>geoip_country_name_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_country_name_by_name</function> function will return the
full country name corresponding to a hostname or an IP address.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose location is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the country name on success, or &false; if the address cannot
be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_country_name_by_name</function> example</title>
<para>
This will print where the host example.com is located.
</para>
<programlisting role="php">
<![CDATA[
<?php
$country = geoip_country_name_by_name('www.example.com');
if ($country) {
echo 'This host is located in: ' . $country;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
This host is located in: United States
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>geoip_country_code_by_name</function></member>
<member><function>geoip_country_code3_by_name</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-database-info">
<refnamediv>
<refname>geoip_database_info</refname>
<refpurpose>Get GeoIP Database information</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>geoip_database_info</methodname>
<methodparam choice="opt"><type>int</type><parameter>database</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_database_info</function> function returns the corresponding
GeoIP Database version as it is defined inside the binary file.
</para>
<para>
If this function is called without arguments, it returns the version
of the GeoIP Free Country Edition.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>database</parameter></term>
<listitem>
<para>
The database type as an integer. You can use the
<link linkend="geoip.constants">various constants</link> defined with
this extension (ie: GEOIP_*_EDITION).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the corresponding database version, or &null; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_region_by_name</function> example</title>
<para>
This will output the current database version string.
</para>
<programlisting role="php">
<![CDATA[
<?php
print geoip_database_info(GEOIP_COUNTRY_EDITION);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
GEO-106FREE 20060801 Build 1 Copyright (c) 2006 MaxMind LLC All Rights Reserved
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-id-by-name">
<refnamediv>
<refname>geoip_id_by_name</refname>
<refpurpose>Get the Internet connection speed</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>integer</type><methodname>geoip_id_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_id_by_name</function> function will return the country
and region corresponding to a hostname or an IP address.
</para>
<para>
The return value is numeric and can be compared to the following constants:
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
GEOIP_UNKNOWN_SPEED
</simpara>
</listitem>
<listitem>
<simpara>
GEOIP_DIALUP_SPEED
</simpara>
</listitem>
<listitem>
<simpara>
GEOIP_CABLEDSL_SPEED
</simpara>
</listitem>
<listitem>
<simpara>
GEOIP_CORPORATE_SPEED
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose net speed is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the net speed.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_id_by_name</function> example</title>
<para>
This will output the net speed of the host example.com.
</para>
<programlisting role="php">
<![CDATA[
<?php
$netspeed = geoip_id_by_name('www.example.com');
echo 'The connection type is ';
switch ($netspeed) {
case GEOIP_DIALUP_SPEED:
echo 'dial-up';
break;
case GEOIP_CABLEDSL_SPEED:
echo 'cable or DSL';
break;
case GEOIP_CORPORATE_SPEED:
echo 'corporate';
break;
case GEOIP_UNKNOWN_SPEED:
default:
echo 'unknown';
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
The connection type is corporate
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-org-by-name">
<refnamediv>
<refname>geoip_org_by_name</refname>
<refpurpose>Get the organization name</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>geoip_org_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_org_by_name</function> function will return the name of
the organization that an IP is assigned to.
</para>
<para>
This function is currently only available to users who have bought a commercial
GeoIP Organization, ISP or AS Edition. A warning will be issued if the proper
database cannot be located.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the organization name on success, or &false; if the address
cannot be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_org_by_name</function> example</title>
<para>
This will print to whom the host example.com IP is allocated.
</para>
<programlisting role="php">
<![CDATA[
<?php
$org = geoip_country_code_by_name('www.example.com');
if ($org) {
echo 'This host IP is allocated to: ' . $org;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
This host IP is allocated to: ICANN c/o Internet Assigned Numbers Authority
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-record-by-name">
<refnamediv>
<refname>geoip_record_by_name</refname>
<refpurpose>Returns the detailed City information found in the GeoIP Database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>geoip_record_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_record_by_name</function> function will return the
record information corresponding to a hostname or an IP address.
</para>
<para>
This function is available for both GeoLite City Edition and commercial GeoIP
City Edition. A warning will be issued if the proper database cannot be
located.
</para>
<para>
The names of the different keys of the returning associative array are as follows:
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
"country_code" -- Two letter country code (see
<function>geoip_country_code_by_name</function>)
</simpara>
</listitem>
<listitem>
<simpara>
"region" -- The region code (ex: CA for California)
</simpara>
</listitem>
<listitem>
<simpara>
"city" -- The city.
</simpara>
</listitem>
<listitem>
<simpara>
"postal_code" -- The Postal Code, FSA or Zip Code.
</simpara>
</listitem>
<listitem>
<simpara>
"latitude" -- The Latitude as signed double.
</simpara>
</listitem>
<listitem>
<simpara>
"longitude" -- The Longitude as signed double.
</simpara>
</listitem>
<listitem>
<simpara>
"dma_code"
</simpara>
</listitem>
<listitem>
<simpara>
"area_code" -- The PSTN area code (ex: 212)
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose record is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the associative array on success, or &false; if the address
cannot be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_record_by_name</function> example</title>
<para>
This will print the array containing the record of host example.com.
</para>
<programlisting role="php">
<![CDATA[
<?php
$record = geoip_record_by_name('www.example.com');
if ($record) {
print_r($record);
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[country_code] => US
[region] => CA
[city] => Marina Del Rey
[postal_code] =>
[latitude] => 33.9776992798
[longitude] => -118.435096741
[dma_code] => 803
[area_code] => 310
)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.geoip-region-by-name">
<refnamediv>
<refname>geoip_region_by_name</refname>
<refpurpose>Get the country code and region</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>geoip_region_by_name</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
</methodsynopsis>
<para>
The <function>geoip_region_by_name</function> function will return the country
and region corresponding to a hostname or an IP address.
</para>
<para>
This function is currently only available to users who have bought a commercial
GeoIP Region Edition. A warning will be issued if the proper database cannot be
located.
</para>
<para>
The names of the different keys of the returning associative array are as follows:
</para>
<para>
<itemizedlist>
<listitem>
<simpara>
"country_code" -- Two letter country code (see
<function>geoip_country_code_by_name</function>)
</simpara>
</listitem>
<listitem>
<simpara>
"region" -- The region code (ex: CA for California)
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
The hostname or IP address whose region is to be looked-up.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the associative array on success, or &false; if the address
cannot be found in the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>geoip_region_by_name</function> example</title>
<para>
This will print the array containing the country code and region
of the host example.com.
</para>
<programlisting role="php">
<![CDATA[
<?php
$region = geoip_region_by_name('www.example.com');
if ($region) {
print_r($region);
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[country_code] => US
[region] => CA
)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Purpose: -->
<!-- Membership: pecl -->
<reference id="ref.geoip">
<title>GeoIP Functions</title>
<titleabbrev>GeoIP</titleabbrev>
<partintro>
<section id="geoip.intro">
&reftitle.intro;
<para>
The GeoIP extension allows you to find the location of an IP address. City,
State, Country, Longitude, Latitude, and other information as all, such as
ISP and connection type can be obtained with the help of GeoIP.
</para>
</section>
<section id="geoip.requirements">
&reftitle.required;
<para>
This extension requires the GeoIP C library version 1.4.0 or higher to be
installed. You can grab the latest version from
<ulink url="http://www.maxmind.com/app/c">http://www.maxmind.com/app/c</ulink>
and compile it yourself.
</para>
<para>
By default, you will only have access to the Free GeoIP Country or GeoLite
City databases. While this module can work with other types of database,
you must buy a commercial license from
<ulink url="http://www.maxmind.com/">Maxmind</ulink>.
</para>
</section>
<section id="geoip.installation">
&reftitle.install;
<para>
&pecl.moved;
</para>
<para>
&pecl.info;
<ulink url="&url.pecl.package;geoip">&url.pecl.package;geoip</ulink>.
</para>
</section>
<section id="geoip.resources">
&reftitle.resources;
&no.resource;
</section>
<!-- Information found in constants.xml -->
&reference.geoip.constants;
</partintro>
&reference.geoip.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->