Maison  >  Article  >  développement back-end  >  有道搜索和IP138的IP的API接口(PHP应用)_PHP教程

有道搜索和IP138的IP的API接口(PHP应用)_PHP教程

WBOY
WBOYoriginal
2016-07-21 15:14:371146parcourir

复制代码 代码如下:

$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);//此代码为有道ip库
if(strpos($ipinfo,'北京') > 0) {
header('HTTP/1.1 301 Moved Permanently');
header("Location: http://www.jb51.net");
}
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/326268.htmlTechArticle复制代码 代码如下: ?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...
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn