<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IP段 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/ip%E6%AE%B5/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 17 Feb 2014 08:49:55 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.1</generator>
	<item>
		<title>根据用户IP段跳转到所在城市页面（2种）</title>
		<link>https://www.mudbest.com/%e6%a0%b9%e6%8d%aeip%e6%ae%b5%e8%b7%b3%e8%bd%ac%e5%88%b0%e6%89%80%e5%9c%a8%e5%9f%8e%e5%b8%82%e9%a1%b5%e9%9d%a2%ef%bc%882%e7%a7%8d%ef%bc%89/</link>
					<comments>https://www.mudbest.com/%e6%a0%b9%e6%8d%aeip%e6%ae%b5%e8%b7%b3%e8%bd%ac%e5%88%b0%e6%89%80%e5%9c%a8%e5%9f%8e%e5%b8%82%e9%a1%b5%e9%9d%a2%ef%bc%882%e7%a7%8d%ef%bc%89/#comments</comments>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Mon, 23 May 2011 09:58:09 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[IP段]]></category>
		<category><![CDATA[跳转]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=654</guid>

					<description><![CDATA[一、本地纯真IP库，首先下载纯真IP库，文件名为qqwry.dat 1、纯真本地IP库 类文件1.php代码如 ... <a title="根据用户IP段跳转到所在城市页面（2种）" class="read-more" href="https://www.mudbest.com/%e6%a0%b9%e6%8d%aeip%e6%ae%b5%e8%b7%b3%e8%bd%ac%e5%88%b0%e6%89%80%e5%9c%a8%e5%9f%8e%e5%b8%82%e9%a1%b5%e9%9d%a2%ef%bc%882%e7%a7%8d%ef%bc%89/" aria-label="阅读 根据用户IP段跳转到所在城市页面（2种）">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>一、本地纯真IP库，首先下载纯真IP库，文件名为qqwry.dat</p>
<p>1、纯真本地IP库<br />
类文件1.php代码如下<br />
<span id="more-654"></span></p>
<pre class="brush: php; title: ; notranslate">
/**
 * 2011-05-11
 * 纯真IP库更新日期 2011-05-17
 * by hkshadow
 * 文件头 &#x5B;第一条索引的偏移量 (4byte)] + &#x5B;最后一条索引的偏移地址 (4byte)]     8字节
 * 记录区 &#x5B;结束ip (4byte)] + &#x5B;地区1] + &#x5B;地区2]                                4字节+不定长
 * 索引区 &#x5B;开始ip (4byte)] + &#x5B;指向记录区的偏移地址 (3byte)]                   7字节
 * 注意:使用之前请去网上下载纯真IP数据库,并改名为 &quot;qqwry.dat&quot; 放到当前目录下即可.
*/
class IpLocation {
	var $fp;
	var $firstip; //第一条ip索引的偏移地址
	var $lastip; //最后一条ip索引的偏移地址
	var $totalip; //总ip数
	//*
	//构造函数,初始化一些变量
	//$datfile 的值为纯真IP数据库的名子,可自行修改.
	//*
	function ipLocation($datfile = &quot;qqwry.dat&quot;) {
		$this-&gt;fp = fopen ( $datfile, &#039;rb&#039; ) or die ( &quot;QQWry.Dat不存在，请去网上下载纯真IP数据库, &#039;QQWry.dat&#039; 放到当前目录下&quot; ); //二制方式打开
		$this-&gt;firstip = $this-&gt;get4b (); //第一条ip索引的绝对偏移地址
		$this-&gt;lastip = $this-&gt;get4b (); //最后一条ip索引的绝对偏移地址
		$this-&gt;totalip = ($this-&gt;lastip - $this-&gt;firstip) / 7; //ip总数 索引区是定长的7个字节,在此要除以7,
		register_shutdown_function ( array ($this, &quot;closefp&quot; ) ); //为了兼容php5以下版本,本类没有用析构函数,自动关闭ip库.
	}
	//*
	//关闭ip库
	//*
	function closefp() {
		fclose ( $this-&gt;fp );
	}
	//*
	//读取4个字节并将解压成long的长模式
	//*
	function get4b() {
		$str = unpack ( &quot;V&quot;, fread ( $this-&gt;fp, 4 ) );
		return $str &#x5B;1];
	}
	//*
	//读取重定向了的偏移地址
	//*
	function getoffset() {
		$str = unpack ( &quot;V&quot;, fread ( $this-&gt;fp, 3 ) . chr ( 0 ) );
		return $str &#x5B;1];
	}
	//*
	//读取ip的详细地址信息
	//*
	function getstr() {
		$split = fread ( $this-&gt;fp, 1 );
		while ( ord ( $split ) != 0 ) {
			$str .= $split;
			$split = fread ( $this-&gt;fp, 1 );
		}
		return $str;
	}
	//*
	//将ip通过ip2long转成ipv4的互联网地址,再将他压缩成big-endian字节序
	//用来和索引区内的ip地址做比较
	//*
	function iptoint($ip) {
		return pack ( &quot;N&quot;, intval ( ip2long ( $ip ) ) );
	}
	//*
	//获取客户端ip地址
	//注意:如果你想要把ip记录到服务器上,请在写库时先检查一下ip的数据是否安全.
	//*
	function getIP() {
		if (getenv ( &#039;HTTP_CLIENT_IP&#039; )) {
			$ip = getenv ( &#039;HTTP_CLIENT_IP&#039; );
		} elseif (getenv ( &#039;HTTP_X_FORWARDED_FOR&#039; )) { //获取客户端用代理服务器访问时的真实ip 地址
			$ip = getenv ( &#039;HTTP_X_FORWARDED_FOR&#039; );
		} elseif (getenv ( &#039;HTTP_X_FORWARDED&#039; )) {
			$ip = getenv ( &#039;HTTP_X_FORWARDED&#039; );
		} elseif (getenv ( &#039;HTTP_FORWARDED_FOR&#039; )) {
			$ip = getenv ( &#039;HTTP_FORWARDED_FOR&#039; );
		} elseif (getenv ( &#039;HTTP_FORWARDED&#039; )) {
			$ip = getenv ( &#039;HTTP_FORWARDED&#039; );
		} else {
			$ip = $_SERVER &#x5B;&#039;REMOTE_ADDR&#039;];
		}
		return $ip;
	}
	//*
	//获取地址信息
	//*
	function readaddress() {
		$now_offset = ftell ( $this-&gt;fp ); //得到当前的指针位址
		$flag = $this-&gt;getflag ();
		switch (ord ( $flag )) {
			case 0 :
				$address = &quot;&quot;;
				break;
			case 1 :
			case 2 :
				fseek ( $this-&gt;fp, $this-&gt;getoffset () );
				$address = $this-&gt;getstr ();
				break;
			default :
				fseek ( $this-&gt;fp, $now_offset );
				$address = $this-&gt;getstr ();
				break;
		}
		return $address;
	}
	//*
	//获取标志1或2
	//用来确定地址是否重定向了.
	//*
	function getflag() {
		return fread ( $this-&gt;fp, 1 );
	}
	//*
	//用二分查找法在索引区内搜索ip
	//*
	function searchip($ip) {
		$ip = gethostbyname ( $ip ); //将域名转成ip
		$ip_offset &#x5B;&quot;ip&quot;] = $ip;
		$ip = $this-&gt;iptoint ( $ip ); //将ip转换成长整型
		$firstip = 0; //搜索的上边界
		$lastip = $this-&gt;totalip; //搜索的下边界
		$ipoffset = $this-&gt;lastip; //初始化为最后一条ip地址的偏移地址
		while ( $firstip &lt;= $lastip ) {
			$i = floor ( ($firstip + $lastip) / 2 ); //计算近似中间记录 floor函数记算给定浮点数小的最大整数,说白了就是四舍五也舍
			fseek ( $this-&gt;fp, $this-&gt;firstip + $i * 7 ); //定位指针到中间记录
			$startip = strrev ( fread ( $this-&gt;fp, 4 ) ); //读取当前索引区内的开始ip地址,并将其little-endian的字节序转换成big-endian的字节序
			if ($ip &lt; $startip) {
				$lastip = $i - 1;
			} else {
				fseek ( $this-&gt;fp, $this-&gt;getoffset () );
				$endip = strrev ( fread ( $this-&gt;fp, 4 ) );
				if ($ip &gt; $endip) {
					$firstip = $i + 1;
				} else {
					$ip_offset &#x5B;&quot;offset&quot;] = $this-&gt;firstip + $i * 7;
					break;
				}
			}
		}
		return $ip_offset;
	}
	//*
	//获取ip地址详细信息
	//*
	function getaddress($ip) {
		$ip_offset = $this-&gt;searchip ( $ip ); //获取ip 在索引区内的绝对编移地址
		$ipoffset = $ip_offset &#x5B;&quot;offset&quot;];
		$address &#x5B;&quot;ip&quot;] = $ip_offset &#x5B;&quot;ip&quot;];
		fseek ( $this-&gt;fp, $ipoffset ); //定位到索引区
		$address &#x5B;&quot;startip&quot;] = long2ip ( $this-&gt;get4b () ); //索引区内的开始ip 地址
		$address_offset = $this-&gt;getoffset (); //获取索引区内ip在ip记录区内的偏移地址
		fseek ( $this-&gt;fp, $address_offset ); //定位到记录区内
		$address &#x5B;&quot;endip&quot;] = long2ip ( $this-&gt;get4b () ); //记录区内的结束ip 地址
		$flag = $this-&gt;getflag (); //读取标志字节
		switch (ord ( $flag )) {
			case 1 : //地区1地区2都重定向
				$address_offset = $this-&gt;getoffset (); //读取重定向地址
				fseek ( $this-&gt;fp, $address_offset ); //定位指针到重定向的地址
				$flag = $this-&gt;getflag (); //读取标志字节
				switch (ord ( $flag )) {
					case 2 : //地区1又一次重定向,
						fseek ( $this-&gt;fp, $this-&gt;getoffset () );
						$address &#x5B;&quot;area1&quot;] = $this-&gt;getstr ();
						fseek ( $this-&gt;fp, $address_offset + 4 ); //跳4个字节
						$address &#x5B;&quot;area2&quot;] = $this-&gt;readaddress (); //地区2有可能重定向,有可能没有
						break;
					default : //地区1,地区2都没有重定向
						fseek ( $this-&gt;fp, $address_offset ); //定位指针到重定向的地址
						$address &#x5B;&quot;area1&quot;] = $this-&gt;getstr ();
						$address &#x5B;&quot;area2&quot;] = $this-&gt;readaddress ();
						break;
				}
				break;
			case 2 : //地区1重定向 地区2没有重定向
				$address1_offset = $this-&gt;getoffset (); //读取重定向地址
				fseek ( $this-&gt;fp, $address1_offset );
				$address &#x5B;&quot;area1&quot;] = $this-&gt;getstr ();
				fseek ( $this-&gt;fp, $address_offset + 8 );
				$address &#x5B;&quot;area2&quot;] = $this-&gt;readaddress ();
				break;
			default : //地区1地区2都没有重定向
				fseek ( $this-&gt;fp, $address_offset + 4 );
				$address &#x5B;&quot;area1&quot;] = $this-&gt;getstr ();
				$address &#x5B;&quot;area2&quot;] = $this-&gt;readaddress ();
				break;
		}
		//*过滤一些无用数据
		if (strpos ( $address &#x5B;&quot;area1&quot;], &quot;CZ88.NET&quot; ) != false) {
			$address &#x5B;&quot;area1&quot;] = &quot;未知&quot;;
		}
		if (strpos ( $address &#x5B;&quot;area2&quot;], &quot;CZ88.NET&quot; ) != false) {
			$address &#x5B;&quot;area2&quot;] = &quot; &quot;;
		}
		return $address;
	}

}

</pre>
<p>输出页面2.php代码如下<!--more--></p>
<pre class="brush: php; title: ; notranslate">
include &quot;1.php&quot;;
header ( &quot;Content-type: text/html; charset=utf-8&quot; );
$local_ip = $_SERVER &#x5B;&#039;REMOTE_ADDR&#039;];  //内网IP，暂未测试
//返回格式
$format = &quot;text&quot;; //默认text,json,xml,js
//返回编码
$charset = &quot;utf8&quot;; //默认utf-8,gbk或gb2312
#实例化(必须)

/**
 * 正则获取外网IP
 * by hkshadow
 * Enter description here ...
 */
function get_onlineip() {
	$ch = curl_init ( &#039;http://tool.chinaz.com/IP/?IP=www.baidu.com&#039; );
	curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
	$a = curl_exec ( $ch );
	preg_match ( &#039;/\&#x5B;(.*)\]/&#039;, $a, $ip );
	$ip &#x5B;1] = strip_tags ( $ip &#x5B;1] ); //去除加粗
	return $ip &#x5B;1];
}
//$b = explode ( &#039;.&#039;, $a );
$ip_l = new ipLocation (); //实例化
$address = $ip_l-&gt;getaddress ( get_onlineip () );

//例一
if((strpos($address&#x5B;&#039;area1&#039;],&#039;武汉&#039;) === false)) {
// 如果是的，则从此处进入网站
// 	header(&#039;HTTP/1.1 301 Moved Permanently&#039;);     
//  header(&quot;Location: /&quot;);
}else{
//否则，恩，你懂得
}
</pre>
<p>2、本地纯真IP库函数和使用方法</p>
<pre class="brush: php; title: ; notranslate">
     header(&quot;Content-type: text/html; charset=utf-8&quot;);
 
//返回当前IP的城市字符串  
function convertip($ip) {  
    //IP数据文件路径  
    $dat_path = &#039;qqwry.dat&#039;;  
  
    //检查IP地址  
    if(!preg_match(&quot;/^(\d{1,2}|1\d\d|2&#x5B;0-4]\d|25&#x5B;0-5])\.(\d{1,2}|1\d\d|2&#x5B;0-4]\d|25&#x5B;0-5])\.(\d{1,2}|1\d\d|2&#x5B;0-4]\d|25&#x5B;0-5])\.(\d{1,2}|1\d\d|2&#x5B;0-4]\d|25&#x5B;0-5])$/&quot;, $ip)) {  
        return &#039;IP Address Error&#039;;  
    }  
    //打开IP数据文件  
    if(!$fd = @fopen($dat_path, &#039;rb&#039;)){  
        return &#039;IP date file not exists or access denied&#039;;  
    }  
  
    //分解IP进行运算，得出整形数  
    $ip = explode(&#039;.&#039;, $ip);  
    $ipNum = $ip&#x5B;0] * 16777216 + $ip&#x5B;1] * 65536 + $ip&#x5B;2] * 256 + $ip&#x5B;3];  
  
    //获取IP数据索引开始和结束位置  
    $DataBegin = fread($fd, 4);  
    $DataEnd = fread($fd, 4);  
    $ipbegin = implode(&#039;&#039;, unpack(&#039;L&#039;, $DataBegin));  
    if($ipbegin &lt; 0) $ipbegin += pow(2, 32);  
    $ipend = implode(&#039;&#039;, unpack(&#039;L&#039;, $DataEnd));  
    if($ipend &lt; 0) $ipend += pow(2, 32);  
    $ipAllNum = ($ipend - $ipbegin) / 7 + 1;  
      
    $BeginNum = 0;  
    $EndNum = $ipAllNum;  
  
    //使用二分查找法从索引记录中搜索匹配的IP记录  
    while($ip1num&gt;$ipNum || $ip2num&lt;$ipNum) {  
        $Middle= intval(($EndNum + $BeginNum) / 2);  
  
        //偏移指针到索引位置读取4个字节  
        fseek($fd, $ipbegin + 7 * $Middle);  
        $ipData1 = fread($fd, 4);  
        if(strlen($ipData1) &lt; 4) {  
            fclose($fd);  
            return &#039;System Error&#039;;  
        }  
        //提取出来的数据转换成长整形，如果数据是负数则加上2的32次幂  
        $ip1num = implode(&#039;&#039;, unpack(&#039;L&#039;, $ipData1));  
        if($ip1num &lt; 0) $ip1num += pow(2, 32);  
          
        //提取的长整型数大于我们IP地址则修改结束位置进行下一次循环  
        if($ip1num &gt; $ipNum) {  
            $EndNum = $Middle;  
            continue;  
        }  
          
        //取完上一个索引后取下一个索引  
        $DataSeek = fread($fd, 3);  
        if(strlen($DataSeek) &lt; 3) {  
            fclose($fd);  
            return &#039;System Error&#039;;  
        }  
        $DataSeek = implode(&#039;&#039;, unpack(&#039;L&#039;, $DataSeek.chr(0)));  
        fseek($fd, $DataSeek);  
        $ipData2 = fread($fd, 4);  
        if(strlen($ipData2) &lt; 4) {  
            fclose($fd);  
            return &#039;System Error&#039;;  
        }  
        $ip2num = implode(&#039;&#039;, unpack(&#039;L&#039;, $ipData2));  
        if($ip2num &lt; 0) $ip2num += pow(2, 32);  
  
        //没找到提示未知  
        if($ip2num &lt; $ipNum) {  
            if($Middle == $BeginNum) {  
                fclose($fd);  
                return &#039;Unknown&#039;;  
            }  
            $BeginNum = $Middle;  
        }  
    }  
  
    $ipFlag = fread($fd, 1);  
    if($ipFlag == chr(1)) {  
        $ipSeek = fread($fd, 3);  
        if(strlen($ipSeek) &lt; 3) {  
            fclose($fd);  
            return &#039;System Error&#039;;  
        }  
        $ipSeek = implode(&#039;&#039;, unpack(&#039;L&#039;, $ipSeek.chr(0)));  
        fseek($fd, $ipSeek);  
        $ipFlag = fread($fd, 1);  
    }  
  
    if($ipFlag == chr(2)) {  
        $AddrSeek = fread($fd, 3);  
        if(strlen($AddrSeek) &lt; 3) {  
            fclose($fd);  
            return &#039;System Error&#039;;  
        }  
        $ipFlag = fread($fd, 1);  
        if($ipFlag == chr(2)) {  
            $AddrSeek2 = fread($fd, 3);  
            if(strlen($AddrSeek2) &lt; 3) {  
                fclose($fd);  
                return &#039;System Error&#039;;  
            }  
            $AddrSeek2 = implode(&#039;&#039;, unpack(&#039;L&#039;, $AddrSeek2.chr(0)));  
            fseek($fd, $AddrSeek2);  
        } else {  
            fseek($fd, -1, SEEK_CUR);  
        }  
  
        while(($char = fread($fd, 1)) != chr(0))  
            $ipAddr2 .= $char;  
  
        $AddrSeek = implode(&#039;&#039;, unpack(&#039;L&#039;, $AddrSeek.chr(0)));  
        fseek($fd, $AddrSeek);  
  
        while(($char = fread($fd, 1)) != chr(0))  
            $ipAddr1 .= $char;  
    } else {  
        fseek($fd, -1, SEEK_CUR);  
        while(($char = fread($fd, 1)) != chr(0))  
            $ipAddr1 .= $char;  
  
        $ipFlag = fread($fd, 1);  
        if($ipFlag == chr(2)) {  
            $AddrSeek2 = fread($fd, 3);  
            if(strlen($AddrSeek2) &lt; 3) {  
                fclose($fd);  
                return &#039;System Error&#039;;  
            }  
            $AddrSeek2 = implode(&#039;&#039;, unpack(&#039;L&#039;, $AddrSeek2.chr(0)));  
            fseek($fd, $AddrSeek2);  
        } else {  
            fseek($fd, -1, SEEK_CUR);  
        }  
        while(($char = fread($fd, 1)) != chr(0)){  
            $ipAddr2 .= $char;  
        }  
    }  
    fclose($fd);  
  
    //最后做相应的替换操作后返回结果  
    if(preg_match(&#039;/http/i&#039;, $ipAddr2)) {  
        $ipAddr2 = &#039;&#039;;  
    }  
    $ipaddr = &quot;$ipAddr1 $ipAddr2&quot;;  
    $ipaddr = preg_replace(&#039;/CZ88.Net/is&#039;, &#039;&#039;, $ipaddr);  
    $ipaddr = preg_replace(&#039;/^s*/is&#039;, &#039;&#039;, $ipaddr);  
    $ipaddr = preg_replace(&#039;/s*$/is&#039;, &#039;&#039;, $ipaddr);  
    if(preg_match(&#039;/http/i&#039;, $ipaddr) || $ipaddr == &#039;&#039;) {  
        $ipaddr = &#039;Unknown&#039;;  
    }  
  
    return $ipaddr;  
}  
  
  
//查找字符串  
function findstr($str, $substr)  
{  
         $m = strlen($str);  
        $n = strlen($substr );  
        if ($m &lt; $n) return false ;  
        for ($i=0; $i &lt;=($m-$n+1); $i ++){  
                $sub = substr( $str, $i, $n);  
                if ( strcmp($sub, $substr) == 0) return true;  
        }  
        return false ;  
}   
&amp;#91;/code&amp;#93;

使用例子

&amp;#91;code lang=&quot;php&quot;&amp;#93;
 $Clientip=$_SERVER&amp;#91;&quot;REMOTE_ADDR&quot;&amp;#93;;  

echo $ClientCity=convertip($Clientip);  //获得所在城市字符串


 $ClientCity = iconv(&quot;gb2312&quot;,&quot;utf-8&quot;,$ClientCity); //将城市字符串由gb2312转化成utf-8编码，用于解决utf-8页面中文乱码

if (findstr($ClientCity,&quot;南昌&quot;)){  
//    Header(&quot;Location: http://www.baidu.com&quot;);  
//echo 2;
}else{  
// echo 1;   
//	Header(&quot;Location: http://google.com.hk&quot;);  
}  
&amp;#91;/code&amp;#93;

方法二
使用腾迅的api接口（挂掉了）
可使用新浪API接口
接口地址：http://int.dpool.sina.com.cn/iplookup/iplookup.php
备淘宝API接口：http://ip.taobao.com/service/getIpInfo.php?ip=101.229.118.140
&amp;#91;code lang=&quot;php&quot;&amp;#93;
function get_ip_place(){
header ( &quot;Content-type: text/html; charset=gbk&quot; );
$ip=file_get_contents(&quot;http://fw.qq.com/ipaddress&quot;);
$ip=str_replace(&#039;&quot;&#039;,&#039; &#039;,$ip);
$ip2=explode(&quot;(&quot;,$ip);
$a=substr($ip2&amp;#91;1&amp;#93;,0,-2);
$b=explode(&quot;,&quot;,$a);
return $b;
}
$ips=get_ip_place();

//例一
if((strpos($ips&amp;#91;&#039;3&#039;&amp;#93;,&#039;武汉&#039;) === false)) {
// 如果是的，则从此处进入网站
// 	header(&#039;HTTP/1.1 301 Moved Permanently&#039;);     
//  header(&quot;Location: /&quot;);
}else{
//否则，恩，你懂得
}
&amp;#91;/code&amp;#93;

2012.11.05新增一种根据用户IP来实现跳转
新浪IP接口：
http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=IP地址
&amp;#91;code lang=&quot;js&quot;&amp;#93;
&lt;script type=text/javascript src=http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js charset=gb2312&gt;&lt;/script&gt;
&lt;script type=text/javascript&gt;
alert(remote_ip_info.city);
 &lt;/script&gt;
</pre>
<p>结合PHP：</p>
<pre class="brush: php; title: ; notranslate">
//直接获取到了一个JSON
$demo = file_get_contents("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=122.12.154.1");
//剩下自由发挥吧
</pre>
<p>我改了2种编码的(gbk 和 utf-8)</p>
<p>下载地址<br />
utf-8<br />
http://help.mudbest.com/ip/qqwry.rar</p>
<p>gbk<br />
http://help.mudbest.com/ip/qqwry-gbk.rar</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mudbest.com/%e6%a0%b9%e6%8d%aeip%e6%ae%b5%e8%b7%b3%e8%bd%ac%e5%88%b0%e6%89%80%e5%9c%a8%e5%9f%8e%e5%b8%82%e9%a1%b5%e9%9d%a2%ef%bc%882%e7%a7%8d%ef%bc%89/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
