ASP: Easily Parse and Consume RSS in Classic ASP
This script should work right out of the box..
<% Call getNews(10)
Sub getNEWS(howManyResults) myRSSfile = "https://rss.news.yahoo.com/rss/tech"
Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.4.0") xmlHttp.Open "Get", myRSSfile, false xmlHttp.Send() myXML = xmlHttp.ResponseText
Set xmlResponse = Server.CreateObject("MSXML2.DomDocument.4.0") xmlResponse.async = false xmlResponse.LoadXml(myXML) Set xmlHttp = Nothing
Set objLst = xmlResponse.getElementsByTagName("item") Set xmlResponse = Nothing
intNoOfHeadlines = objLst.length -1
For i = 0 To (intNoOfHeadlines) Set objHdl = objLst.item(i)
for each child in objHdl.childNodes Select case lcase(child.nodeName) case "title" title = child.text case "link" link = child.text case "description" description = child.text 'You can also use the following: author,category,comments,enclosure,guid,pubDate,source End Select next
kk = kk+1 if kk < howManyresults+1 then Response.Write "
" & title & "
" & description
end if
Next End Sub %>