what is the best method to get visitors country code by IP between the 2 following methods:
Using MaxMind geoip database here.
Run a local whois and grep for the word country like this
$ip = $_SERVER['REMOTE_ADDR']; // Get users IP $country = exec("whois $ip | grep -i country"); $country = str_replace('country: ', '', $country);
I heard that running a local who is is only work in linux server, is this correct?