Copy code The code is as follows:
$myip = $_SERVER["REMOTE_ADDR"];
//ip138 http://wap.ip138.com/ip.asp?ip=www.myolnet.com
//youdao http://www.youdao.com/smartresult-xml/search.s?type= ip&q=ip
$ipinfo=fcontents("http://www.youdao.com/smartresult-xml/search.s?type=ip&q=".$myip);//This code is Youdao ip library
if(strpos($ipinfo,'Beijing') > 0) {
header('HTTP/1.1 301 Moved Permanently');
header("Location: http://www.jb51.net ");
}
?>
http://www.bkjia.com/PHPjc/326268.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326268.htmlTechArticleCopy the code as follows: ?php $myip = $_SERVER["REMOTE_ADDR"]; //ip138 http:/ /wap.ip138.com/ip.asp?ip=www.myolnet.com //youdao http://www.youdao.com/smartresult-xml/search.s?type...