Detect country by IP

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
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Detect country by IP

Post by tonchily »

As the title says, how can I detect a country of the visitor based on the IP address he's surfing on my website and echo it out?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Detect country by IP

Post by John Cartwright »

There is no algorithm to determine geographic location strictly based on IP. As such, you need an updated GeoIP service (since IP blocks are traded frequently), such as MaxMind.
Post Reply