Country based redirection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sandeep_from
Forum Newbie
Posts: 5
Joined: Fri Dec 15, 2006 8:04 am

Country based redirection

Post by sandeep_from »

Hi,

I need to implement a country based redirection using the visitor's IP address as reference.

I did some googling and found that some sites are offering an IP-Country database for about $50, some have a monthly Update charges too and some are offering it free.
I am confused... which ones to choose.

If the sites offering free list do not update, then my efforts of developing the code is wasted..
If paid sites do not update, then my money & efforts are wasted.

I am looking for feedback from users who are currently using such redirection database and their experiences.

I need a list which is regularly updated... and nothing better if its free ;)
Where do these people get such a list !!!!

I look forward to member's views & suggestions.

Thank you.

regards,
Sandeep
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Country based redirection

Post by onion2k »

sandeep_from wrote:If the sites offering free list do not update, then my efforts of developing the code is wasted..
IP geolocation lists don't change very often. Even if there's no updates to the list it'll still be pretty accurate in years to come.
sandeep_from
Forum Newbie
Posts: 5
Joined: Fri Dec 15, 2006 8:04 am

Re: Country based redirection

Post by sandeep_from »

onion2k wrote:IP geolocation lists don't change very often. Even if there's no updates to the list it'll still be pretty accurate in years to come.

But what about new IP banks purchased by ISP's all the times.
They need to be updated, I guess.

Buy my original question remains unanswered.... Which site's db is the best ?

Thx
Sandeep
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

If I'm not mistaken, IP banks are leased, not purchased. And it only makes sense that they're leased by the ISP's upstream provider, so they're probably in the same country.

Also, if geo information is that important to your app, you should at very least allow the user to correct their assumed location.

I would cheap out and get a free DB, allowing the user to correct me by selecting CANADA [change] (or some similar flag-based coolness)

Cheers,
Kieran
gaugelive
Forum Newbie
Posts: 1
Joined: Sat Dec 16, 2006 10:24 am

Post by gaugelive »

Maxmind offers a free monthly updated country database (http://www.maxmind.com) (http://www.maxmind.com/app/geoip_country)

Use it as follows from within a php script:

Code: Select all

$country_code = apache_note("GEOIP_COUNTRY_CODE");
$country_name = apache_note("GEOIP_COUNTRY_NAME");
Maxmind claims that about 5% of the database changes every month and I have found some IP's not being correctly recognized when its not updated for several months.


The following must be installed to use mod_geoip from PHP.
* GeoIP C Library
* Apache web server
* GeoIP Apache module
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

gaugelive wrote:Maxmind claims that about 5% of the database changes every month and I have found some IP's not being correctly recognized when its not updated for several months.
8O

wow - good to know!!!
Post Reply