ASP读取RSS

        Function readrss(xmlseed)
            
dim xmlDoc 
            
dim http
            
Set http=Server.CreateObject("Microsoft.XMLHTTP"
            http.Open 
"GET",xmlseed,False 
            http.send 
            
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM"
            xmlDoc.Async
=False 
            xmlDoc.ValidateOnParse
=False 
            xmlDoc.Load(http.ResponseXML)
            
Set item=xmlDoc.getElementsByTagName("item")
            
if item.Length<=0 then
                Response.Write(
"[Nothing]")
            
else
                Response.Write(
"<ul style=""margin-left:15px; list-style-type:square;font-size:12px;line-height:20px;"">")
                
For i=0 To (item.Length-1)
                    
Set title=item.Item(i).getElementsByTagName("title")
                    
Set link=item.Item(i).getElementsByTagName("link")
                    Response.Write(
"<li><a href="""& link.Item(0).Text &""" target=""_blank"">"& title.Item(0).Text &"</a></li>")
                
Next
                Response.Write(
"</ul>")
            
end if
            
set item=nothing
            
set xmlDoc=nothing
            
set http=nothing
        
End Function
        
call readrss("http://2008.67ge.com/feed")

posted on 2008-11-26 13:51  oldmanwang  阅读(258)  评论(0编辑  收藏  举报

导航