![]() |
Anyone using the Maxmind geoip lookup?
This thing is just returning United States for every non-US IP I throw at it.. wtf?
<?php include_once("geoip.inc"); $open = geoip_open("GeoIP.dat", GEOIP_STANDARD); print geoip_country_code_by_addr($open, "62.41.77.63"); geoip_close($open); ?> Should return DE for Germany but it says US from everything.. |
I will have to check some older sites to get you the proper code.
|
Code:
$bad_country_codes = Array('CN', 'JP', 'TW'); Have you checked you're not giving it a US ip all the time? You can go to maxmind.com and enter the IP there and it will tell you the location of the IP so you will be able to see whether you've given it a US ip or your code is wrong. |
i blocked out the following countries also : IR ID KR VE IN
|
I just started using it recently, I wanted to block the Dominican Republic from some of my cascades but it keeps thinking the DR is Canada.
|
I use the Perl Binary;
Code:
#!/usr/bin/perl |
I will also load a probably huge file on every page load.
Do yourself a favor and import the data into a database. |
Quote:
Mysql DB will be huge enough and searching mysql db will not take less resource than searching their dat file... I'm using other method to opimize this - caching resolved countries for visitor IP's , so at least when single surfer is visiting page(s) with geo detection multiple times within day or two, it only searches .dat file once for him. |
I use it all the time, and it works great. Try this instead:
Code:
<?php |
Quote:
|
http://www.geoplugin.com/ Better, use it. Made by Borked, user here.
|
best way to optimize maxmind is to use the apache module mod_geoip
|
Quote:
Code:
Geolocation results for 62.41.77.63: |
Quote:
|
Tried filling in the full path and it still functions the same, totally weird it just says US for any IP I feed to it..
Thanks Borked the geoplugin works great! :thumbsup I did have to copy and paste the PHP class source and save it that way because the Winrar download on there (http://www.geoplugin.com/_media/webs...&cache =cache) opens as a corrupt 0kb file for me..? |
I can only assume you aren't hard coding the URL, as you seem to have managed to handle things properly.
Are you caching the page with some WP-Supercache or other shit? If you have /any/ form of caching on this, it's not going to re-execute depending on how you are calling it. |
Quote:
|
I was asked about maxmind recently, seems popular
|
Quote:
http://www.geoplugin.com/_media/webs....class.php.tgz or download from PHPClasses the classes from either source will be more up to date than the source you copy/pasted |
Quote:
Grabbed the one from phpclasses and it works fine just like the one I copy and pasted from your site. Thanks! |
Quote:
You will take a HUGE performance hit going to mysql. Don't listen to Davy. |
All times are GMT -7. The time now is 05:08 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc