For all those who cant import those large tables for geo locating. I made this grabber. it uses curl and fetch results from remote server. Script returns array with country name, link to country flag and country shorthand name ( information is based on user IP).
NOTE: I dont know for how long will this script work.
I tested it on my PC and phone and it shows correct results. I hope that it helps someone.
PHP Code:
// use it like this
$array = require 'path/to/geoip_curl.php';
//country name
$name = $array['NAME'];
//country flag
$flag_url = $array['IMG'];
//short name
$abbr = $array['ABBR'];
//show results
echo 'Country: ' . $name . "[$abbr]";
echo "<img src='{$flag_url}' />";
I tested it on my PC and phone and it shows correct results. I hope that it helps someone.
Comment