2012-09-01 60 views

回答

0

您可以使用PHP来做到这一点:

<?php 
$ip = $_SERVER['REMOTE_ADDR']; 
$file = file_get_contents("http://api.hostip.info/?ip={$ip}"); 
if(stristr($file, 'bad country') === FALSE) { 
    echo 'ya\'ll may visit this here site.'; 
    } 

else { 
echo "nope!"; 
} 
?> 
+0

嗨,本,你测试过了吗?我收到'504 Gateway Time-out'错误。 – Mahbub

+0

您是否设置了正确的国家? –

+0

它为我工作 –