<?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>simplexml归档 - 布鲁文的蓝色奇想</title>
	<atom:link href="https://www.mrven.com/node/tag/simplexml/feed" rel="self" type="application/rss+xml" />
	<link>https://www.mrven.com/node/tag/simplexml</link>
	<description>A MRVEN SITE</description>
	<lastBuildDate>Fri, 11 Apr 2008 07:19:35 +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>用SimpleXML函数解析AWIS（Alexa Web Information Service）数据</title>
		<link>https://www.mrven.com/node/152</link>
					<comments>https://www.mrven.com/node/152#respond</comments>
		
		<dc:creator><![CDATA[Ven]]></dc:creator>
		<pubDate>Fri, 11 Apr 2008 07:19:35 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[awis]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[simplexml]]></category>
		<guid isPermaLink="false">http://www.naks.cn/blueven/?p=152</guid>

					<description><![CDATA[<p>公司要用Alexa Web Information Service（简称AWIS）做一个网站查询系统。 AWI [&#8230;]</p>
<p><a href="https://www.mrven.com/node/152">用SimpleXML函数解析AWIS（Alexa Web Information Service）数据</a>最先出现在<a href="https://www.mrven.com">布鲁文的蓝色奇想</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>公司要用Alexa Web Information Service（简称AWIS）做一个网站查询系统。</p>
<p>AWIS的工作原理是：用户发送一个URL请求，该请求包含账号ID与密码（是的，这个API是收费的，每千次查询0.15美元） 、需要查询的网址和查询信息的种类等。Alexa的服务器接收请求后，返回一个XML文件，该文件即包含了结果信息。</p>
<p>本打算用PHP的SimpleXML函数来解析这个XML，但SimplyXML不支持Alexa自定义的Name Space（aws:），于是想到个办法，把这个自定义的Name Space删除掉。结果一切就正常了。</p>
<p>示例代码如下：</p>
<p>$filecontent  = file_get_contents( $awis_url ); //从alexa获取数据<br />
$filecontent = str_replace(&#8216;aws:&#8217;,&#8221;,$filecontent); //剔除aws:<br />
$xml =  simplexml_load_string( $filecontent  );</p>
<p>这只是一种简单、懒惰的解决方法。它不够强健， 无法应对多种多样的自定义namespace。如果你追求完美，请参考以下文档：</p>
<p><a href="http://devzone.zend.com/node/view/id/688#Heading3" target="_blank">http://devzone.zend.com/node/view/id/688#Heading3</a></p>
<p><a href="https://www.mrven.com/node/152">用SimpleXML函数解析AWIS（Alexa Web Information Service）数据</a>最先出现在<a href="https://www.mrven.com">布鲁文的蓝色奇想</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mrven.com/node/152/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
