<?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查询归档 - 布鲁文的蓝色奇想</title>
	<atom:link href="https://www.mrven.com/node/tag/ip%E6%9F%A5%E8%AF%A2/feed" rel="self" type="application/rss+xml" />
	<link>https://www.mrven.com/node/tag/ip查询</link>
	<description>A MRVEN SITE</description>
	<lastBuildDate>Thu, 05 Feb 2009 04:37:59 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.1</generator>
	<item>
		<title>ip-国家查询之MySQL+PHP版</title>
		<link>https://www.mrven.com/node/372</link>
					<comments>https://www.mrven.com/node/372#comments</comments>
		
		<dc:creator><![CDATA[Ven]]></dc:creator>
		<pubDate>Thu, 05 Feb 2009 04:37:59 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[ip查询]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://www.naks.cn/blueven/?p=372</guid>

					<description><![CDATA[<p>这个IP-国家查询库使用Webnet77整理的数据，包含了9万多个IP段，在免费数据中是最完整的了（原地址）。 [&#8230;]</p>
<p><a href="https://www.mrven.com/node/372">ip-国家查询之MySQL+PHP版</a>最先出现在<a href="https://www.mrven.com">布鲁文的蓝色奇想</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>这个IP-国家查询库使用<a href="http://webnet77.com/" target="_blank">Webnet77</a>整理的数据，包含了9万多个IP段，在免费数据中是最完整的了（<a href="http://software77.net/cgi-bin/ip-country/geo-ip.pl" target="_blank">原地址</a>）。我把它转换成了MySQL数据表，同时加入了中文国家名。</p>
<p>使用时，先把<a href="wp-content/uploads/iptocountrysql.zip">SQL文件</a>导入数据库。数据库有点大，完整大小8390KB，压缩后1.19MB，如果你无法一次性导入这么大的数据，可以考虑使用一些导入工具，比如<a href="http://www.ozerov.de/bigdump.php" target="_blank">Bigdump</a>。</p>
<p>查询时，先用ip2long()函数把xxx.xxx.xxx.xxx形式的IP（标准地址）转换成int数据（IPv4地址），然后执行查询：</p>
<p>$query = &#8220;SELECT * FROM iptocountry WHERE lower_bound &lt;= $ip AND upper_bound &gt;= $ip&#8221;;</p>
<p>详细代码就不写了，大致就是上面的那个意思。</p>
<p><a href="wp-content/uploads/iptocountrysql.zip">下载SQL文件</a></p>
<p><a href="https://www.mrven.com/node/372">ip-国家查询之MySQL+PHP版</a>最先出现在<a href="https://www.mrven.com">布鲁文的蓝色奇想</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mrven.com/node/372/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
