Skip to main content

Alison Pope's Library tagged rss   View Popular

13 Nov 08

Tabbloid

» ASP: Easily Parse and Consume RSS in Classic ASP

  • <%

    Call getNews(10)

     

    Sub getNEWS(howManyResults)

    myRSSfile = "http://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 "<br /><a href=""" & link & """>" & title & "</a> <br> " & description

     

        end if

     

    Next

    End Sub

    %>
1 - 20 of 45 Next › Last »
Showing 20 items per page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo