Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
I want to show country flag depending on ip address I receive at server side.
Are fixed ip addresses are assigned to countries ? Where can I get database for ip address to country mapping ?
Open Sourced self contained flag rendering based on IP:
It will lookup UV coordinates in a flag texture atlas that matches an arbitrary IP.
And it comes with the IP range database and the texture.
Take a look at the following:
Also on Stack Overflow:
Once you have the country code, then you can display the flag with these free icon sets which use ISO country codes:
PHP Advent also just published a whole article on a very similar process:
It would be nice to know which resource/link you used to solve your problem.
Maxmind is the one we use
ip2location.com provides an IP range database which can be used to tag IP addresses
they provide it in different formats as well so you can choose which one is useful to you
but it isn't free :(
You're looking for an IP geolocation service such as MaxMind.
Or GeoBytes (geobytes.com/IpLocator.htm?GetLocation), or... We should all probably just edit this answer (which is, generically, use a reference site) with a list of them. :-)
@T.J.Crowder it is not showing exact location. Shown some other.
@udaykiranpulipati: These things are imperfect.