From Google and Stack Overflow
I searched your query on Google and found a great Stack Overflow thread. In summary here is the solutions:
You can use APIs:
Hostinfo API:
http://www.hostip.info/use.html
Or you can use a local database on your server, it does need to be updated regularly though.
http://phpweby.com/software/ip2country
If you have money, you can use the Maxmind GeoAPI built-in to your PHP server.
http://php.net/manual/en/book.geoip.php
You want to check the original stack overflow thread here http://stackoverflow.com/questions/3...dress-with-php