IP to country in counter report in drupal
Hi all I am new to drupal making site on drupal. In this I want to show countr report like fiddzit live trafic feed. I wan开发者_JAVA百科t to convert counter report style according to that and show on every page.
But in counter report it show according to IP. How can I convert IP into country
Any help will be appriciated
A good place to start is looking through the existing modules and see if there is one that meets your needs. It just happens there are at least two modules that fit your description:
- IP-based Determination of a Visitor's Country
- IP to Country (on the module description page you will even find a list of other similar modules).
So it looks like you just need to do a bit of research and find the best module for you. Good luck!
Take a look at Smart IP. It allows for Device Geolocation, with free and paid geographic data options and there is a code snippet with an example of converting an IP to a country. From the Smart IP project page:
<?php $smart_ip_session = smart_ip_session_get('smart_ip'); ?>
<?php if ($smart_ip_session['location']['country_code'] == 'AR'): ?>
<p>Argentina HTML content specific</p>
<?php elseif ($smart_ip_session['location']['country_code'] == 'UY'): ?>
<p>Uruguay HTML content specific</p>
<?php else: ?>
<p>Fallback default content.</p>
<?php endif; ?>
精彩评论