Youdao search and IP138 IP API interface (PHP application)_PHP tutorial

WBOY
Release: 2016-07-21 15:14:37
Original
1144 people have browsed it

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 ");
}
?>

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!