downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

geoip_db_get_all_info> <geoip_db_avail
[edit] Last updated: Fri, 24 May 2013

view this page in

geoip_db_filename

(PECL geoip >= 1.0.1)

geoip_db_filenameDevuelve el nombre del fichero correspondiente a la base de datos de GeoIP

Descripción

string geoip_db_filename ( int $database )

La función geoip_db_filename() devuelve el nombre del fichero que corresponde a la base de datos GeoIP.

No indica si el fichero existe o no en el disco, sólo en donde la librería está buscando el fichero de la base de datos.

Parámetros

database

El tipo de base de datos como entero. Se pueden usar varias constantes definidas con la extensión (ej: GEOIP_*_EDITION).

Valores devueltos

Devuelve el nombre del fichero correspondiente a la base de datos o NULL en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de geoip_db_filename()

Mostrará el nombre del fichero que corresponde a la base de datos.

<?php

print geoip_db_filename(GEOIP_COUNTRY_EDITION);

?>

El resultado del ejemplo sería:

/usr/share/GeoIP/GeoIP.dat



add a note add a note User Contributed Notes geoip_db_filename - [1 notes]
up
0
Loc d&#39;Anterroches
2 years ago
To quickly know which databases are available on your system:

<?php
$cst
= array(
            
'GEOIP_COUNTRY_EDITION' => GEOIP_COUNTRY_EDITION,
            
'GEOIP_REGION_EDITION_REV0' => GEOIP_REGION_EDITION_REV0,
            
'GEOIP_CITY_EDITION_REV0' => GEOIP_CITY_EDITION_REV0,
            
'GEOIP_ORG_EDITION' => GEOIP_ORG_EDITION,
            
'GEOIP_ISP_EDITION' => GEOIP_ISP_EDITION,
            
'GEOIP_CITY_EDITION_REV1' => GEOIP_CITY_EDITION_REV1,
            
'GEOIP_REGION_EDITION_REV1' => GEOIP_REGION_EDITION_REV1,
            
'GEOIP_PROXY_EDITION' => GEOIP_PROXY_EDITION,
            
'GEOIP_ASNUM_EDITION' => GEOIP_ASNUM_EDITION,
            
'GEOIP_NETSPEED_EDITION' => GEOIP_NETSPEED_EDITION,
            
'GEOIP_DOMAIN_EDITION' => GEOIP_DOMAIN_EDITION,
             );

foreach (
$cst as $k=>$v) {
    echo
$k.': '.geoip_db_filename($v).'  '.(geoip_db_avail($v) ? 'Available':'').'<br>';
}
?>

The only drawback of the PECL extension with respect to a pure PHP implementation is that you cannot select yourself where the database is. So, if you get a new version of the database, you need to put in the standard place and you may need root access to do so.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites