I wanna display user's/visitor's country flag on my site.
I am using different technologies like php,jsp and simple html. So I want a code which by placing on my site, visitors can see and it should run in all platform.
In short I want country detection API. If anybody can help me, I'll be very thankful.
Via the WordPress admin go to Plugins => Add New. Enter 'SVG Flags' (without quotes) in the text box and click the 'Search Plugins' button. In the list of relevant Plugins click the 'Install' link for SVG Flags on the right hand side of the page. Click the 'Install Now' button on the popup page.
National flags. The colours and designs of national flags usually are not arbitrarily selected but rather stem from the history, culture, or religion of the particular country. Many flags can be traced to a common origin, and such “flag families” are often linked both by common traditions and by geography.
Source :
http://www.shorter.in/#flag
<a href="http://www.shorter.in/#flag" target="_blank"><img src="http://shorter.in/flag.php"></a>
Example for the code given above.
a busy cat http://shorter.in/flag.php
I guess this is what you are looking for.
My service, ipdata.co provides an IP Geolocation API on https://api.ipdata.co and serves flags on for example https://ipdata.co/flags/cu.png.
All you have to do is know your visitors' country's iso code and you can fill it in
ipdata.co/flags/country-code.png
You can of course get the user's country code by calling https://api.ipdata.co/user-ip.
Sample embed;
<img src="https://ipdata.co/flags/us.png" alt="US Flag">
Gives
Edit
We now also provide you with the country emoji flag and country emoji unicode.
Yeah there is something already available and you don't have to reinvent the wheel.
Check this thing out.
http://api.hostip.info/flag.php?ip=12.215.42.19
Grab your user's IP using PHP and pass it to the API.
<?php
$ip=$_SERVER['REMOTE_ADDR'];
?>
<?php
$ip=$_SERVER['REMOTE_ADDR'];
echo "<img src='http://api.hostip.info/flag.php?ip=$ip' />";
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With