Saša Stamenković, a web developer, is working on and sharing a very useful resource.
It is a “list of all countries in many languages and data formats” that is usually needed by many web projects.
The data formats include HTML, JSON, PHP, SQL, CSV, YAML, text and there are SQL dumps for major databases.
Also, with the help of the world-flags-sprite, there is a HTML version of the list with the country flags.
Detecting the city or country of a website visitor is an essential point in offering location based web services or content.
Loading the related language version of the website, showing different banners to visitor from foreign countries and even blocking visitors from certain locations are some examples.
IP information is the most accurate data in determining a visitor’s location.
MaxMind, a company which is one of the best in geolocation services, offers country and city IP database for free besides the paid versions. The difference between free and the paid versions are the accuracy level as free versions are updated once every month rather than every week. With a small mistake margin, they may provide what you need.
Country and city IP data comes in two versions: binary & XLS. Open source binary APIs are avaliable for PHP, Perl, Ruby & other popular languages.