有道搜索和IP138的IP的API接口(PHP应用)
程序员文章站
2022-06-29 21:30:24
复制代码 代码如下:
<?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=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: //www.jb51.net");
}
?>
复制代码 代码如下:
<?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=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: //www.jb51.net");
}
?>
上一篇: 红萝卜山药小常识,看看他们有哪些碰撞
下一篇: 食堂的阿姨