ASP调用远程XML数据的代码(alexa排名数据)


复制代码 代码如下:

<%
URL="http://news.163.com/special/00011K6L/rss_newstop.xml"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", url, False
xml.Send
Set xmlDom = server.createObject("microsoft.xmldom")
xmlDom.async=False
xmlDom.ValidateOnParse=false
xmlDom.load(xml.responseXML)
if xmlDom.ReadyState>2 Then
set oItem=xmlDom.getElementsByTagName("item")
%>
<table width="550" border="0" cellpadding="3" cellspacing="1" bgcolor="#ECEFF4">
<%
for i=0 to oItem.length-1
word=oItem(i).childNodes(0).text
title=oItem(i).childNodes.item(0).text
Link=oItem(i).childNodes.item(1).text
pubDate=oItem(i).childNodes.item(3).text
%>
<tr>
<td height="24" bgcolor="#FFFFFF">·<a href="<%=link%>" target="_blank"><font style="font-size:14px;" color="#003366"><%=word%> </font><font color="#999999">(<%=pubdate%>)</font></a></td>
</tr>
<%
next
end if
%>
</table>

远程文件的内容如下:
复制代码 代码如下:

<?xml version="1.0" encoding="GBK"?>
<?xml-stylesheet type="text/css" href="http://news.163.com/css/allrss.css"?>
<rss version="2.0">
<channel>
<title>网易头条新闻</title>
<link>http://news.163.com/</link>
<description>网易头条新闻</description>
<pubDate>Wed, 16 Feb 2011 02:59:02 GMT</pubDate>
<lastBuildDate>Wed, 16 Feb 2011 02:59:02 GMT</lastBuildDate>
<item id="1">
<title><![CDATA[一线城市房租连涨]]></title>
<link>http://news.163.com/11/0216/10/6T0NIHOA00014JB6.html</link>
<description><! [CDATA[从去年底开始掀起的租金涨价潮,在春节后继续放大。记者在春节后接连接到租金上涨的消息,北京、上海、广州等一线城市房屋的租金持续上涨,很多中介开年后,重新刷新了年前房屋的出租价格,住房、商铺、写字楼的租金都上涨了10%左右不等。记者昨日走访了广州的多家中介,中介普遍反映租赁市场火热,成交单中租单已是卖单五 ]]>......</description>
<pubDate>2011-02-16 10:59:02</pubDate>
</item>
<item id="2">
<title><![CDATA[山东部分面粉厂因农民惜售商人囤粮停产]]></title>
<link>http://focus.news.163.com/11/0216/11/6T0R9MIE00011SM9.html</link>
<description><! [CDATA[民以食为天,粮价乃百价之基。 2010年下半年开始的粮价上涨引发中国经济的连锁反应,又因去秋以来的北方大旱加剧粮价上涨预期,最近国际粮价屡创新高。 稳定物价坐上了今年中国经济的“头把交椅”。春节期间,国务院总理温家宝专程奔赴粮食主产区作出最新指示,国务院常务会议则迅速出台保护粮食生产的“国十条”。 那么百 ]]>......</description>
<pubDate>2011-02-16 11:30:40</pubDate>
</item>
</channel>
</rss>

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3