GEOIP_DB_GET_ALL_INFO(3) 1 GEOIP_DB_GET_ALL_INFO(3)geoip_db_get_all_info - Returns detailed information about all GeoIP database typesSYNOPSIS
array geoip_db_get_all_info (void )
DESCRIPTION
The geoip_db_get_all_info(3) function will return detailed information as a multi-dimensional array about all the GeoIP database types.
This function is available even if no databases are installed. It will simply list them as non-available.
The names of the different keys of the returning associative array are as follows:
o "available" -- Boolean, indicate if DB is available (see geoip_db_avail(3))
o "description" -- The database description
o "filename" -- The database filename on disk (see geoip_db_filename(3))
RETURN VALUES
Returns the associative array.
EXAMPLES
Example #1
A geoip_db_get_all_info(3) example
This will print the array containing all the information.
<?php
$infos = geoip_db_get_all_info();
if (is_array($infos)) {
var_dump($infos);
}
?>
The above example will output:
array(11) {
[1]=>
array(3) {
["available"]=>
bool(true)
["description"]=>
string(21) "GeoIP Country Edition"
["filename"]=>
string(32) "/usr/share/GeoIP/GeoIP.dat"
}
[ ... ]
[11]=>
array(3) {
["available"]=>
bool(false)
["description"]=>
string(25) "GeoIP Domain Name Edition"
["filename"]=>
string(38) "/usr/share/GeoIP/GeoIPDomain.dat"
}
}
Example #2
A geoip_db_get_all_info(3) example
You can use the various constants as keys to get only parts of the information.
<?php
$infos = geoip_db_get_all_info();
if ($infos[GEOIP_COUNTRY_EDITION]['available']) {
echo $infos[GEOIP_COUNTRY_EDITION]['description'];
}
?>
The above example will output:
GeoIP Country Edition
PHP Documentation Group GEOIP_DB_GET_ALL_INFO(3)
Check Out this Related Man Page
GEOIPUPDATE(1) General Commands Manual GEOIPUPDATE(1)NAME
geoipupdate - a program for updating the MaxMind GeoIP databases
SYNOPSIS
geoipupdate [-v] [-f licensefile]
DESCRIPTION
geoipupdate automatically updates the GeoIP database for GeoIP subscribers. It connects to the MaxMind GeoIP Update server and checks for
an updated database. If it finds an updated database, then it downloads it, uncompresses it, and installs it. If you are running a fire-
wall, it requires that the DNS and HTTP (80) ports be open.
For example
geoipupdate -v
Performs the update in verbose mode.
OPTIONS -v Verbose mode, prints out the steps that geoipupdate takes.
-d Specify a custom directory target to install the GeoIP datafile(s). By default geoipupdate installs to /usr/share/GeoIP
-f Specifies the configuration file that contains the license key. Defaults to /etc/GeoIP.conf
USAGE
Typically you'll want to write a weekly crontab that will run geoipupdate. Below is a sample crontab that runs geoipupdate on each Wednes-
day at noon:
# top of crontab
MAILTO=your@email.com
0 12 * * 3 BIN_DIR/geoipupdate
# end of crontab
To use with a proxy server, set the http_proxy environment variable. E.g.
export http_proxy="http://proxy-hostname:port"
RETURN CODES
geoipupdate returns 0 on success, 1 on error.
FILES
/etc/GeoIP.conf
Configuration file for GeoIP, should contain license key.
AUTHOR
Written by T.J. Mather
REPORTING BUGS
Report bugs to <support@maxmind.com>
COPYRIGHT
Copyright (C) 2011 MaxMind LLC
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
Visit <http://www.maxmind.com/app/products> to sign up for a GeoIP subscription.
geoiplookup(1), crontab(5)4th Berkeley Distribution 5 Oct 2010 GEOIPUPDATE(1)