I am using the binary version of the MaxMind GEOIPCITY database. The following code gives me all the necessary information about my visitors:
include("geoipcity.inc"); include("geoipregionvars.php"); $gi = geoip_open("GeoLiteCity.dat", GEOIP_STANDARD); print_r( geoip_db_get_all_info() ); $record = geoip_record_by_addr($gi, $user_ip); print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "<br /><br />"; print $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "<br /><br />"; print $record->city . "<br /><br />"; print $record->postal_code . "<br /><br />"; print $record->latitude . "<br /><br />"; print $record->longitude . "<br /><br />"; print $record->metro_code . "<br /><br />"; print $record->area_code . "<br /><br />"; print $record->continent_code . "<br /><br />"; geoip_close($gi);
I really don't need anything except network speed, ISP, etc.
My problem: there are parts of my site where I need to display all cities under a specific state or all states / regions in a specific country. For example, I need to do this on the registration form.
Is there no way to get these lists by querying a binary? or do i need to handle all this from the mysql version?
I would prefer to use only the binary version, as itβs faster, but now Iβm not sure if all zip codes are displayed under a certain city or all states in a certain country, etc. possible without using the mysql version. Do I need to use both?
http://www.maxmind.com/app/php http://geolite.maxmind.com/download/geoip/api/php/
TK123 source share