My problem is: I need to restrict access to people from another country such as Japan . As I do so that no one in Japan can go to my website ?
Use http://ipinfo.io/ API. The code looks like: (PHP)
$allowed_countries = array("IN", "US", ...);
$country = file_get_contents("http://ipinfo.io/{$_SERVER['REMOTE_ADDR']}/country");
if(!in_array($country, $allowed_countries))
{
echo 'Restricted'; //or any error message.
}