Quantcast
Viewing latest article 1
Browse Latest Browse All 2

RSS Feed Reader


If this is a windows application you can use the webbrowser control and then set its document text to the returned RSS feed string:

wbrRSS.DocumentText = ProcessRSS("http://feeds.rapidfeeds.com/27057/", "Regpro")


If you are trying to display this on a webpage you can chang the function to a sub and then use Responce.Write to display the returned html on your page:
(I renamed your top two variables to keep my head straight)
    Public Sub ProcessRSS(ByVal rssURL As String, ByVal feed As String)

        Dim wbRequest As WebRequest = WebRequest.Create(rssURL)
        Dim wbResponse As WebResponse = wbRequest.GetResponse()
        Dim sb As New StringBuilder("")
        Dim rssStream As Stream = wbResponse.GetResponseStream()
        Dim rssDoc As New XmlDocument()
        rssDoc.Load(rssStream)

        Dim rssItems As XmlNodeList = rssDoc.SelectNodes("rss/channel/item")

        Dim title As String = ""
        Dim link As String = ""
        Dim upperlimit As Integer = rssItems.Count

        If upperlimit > 5 Then
            upperlimit = 5
        End If

        If upperlimit > 0 Then
            sb.Append("<p>" + feed + "</p><ul>")
            Dim i As Integer = 0
            While i < upperlimit

                Dim rssDetail As XmlNode
                rssDetail = rssItems.Item(i).SelectSingleNode("title")
                title = rssDetail.InnerText
                rssDetail = rssItems.Item(i).SelectSingleNode("link")
                link = rssDetail.InnerText

                sb.Append("<li><a href='" + link + "' target='_blank'>" + title + "</a></li>")
                i += 1
            End While
            sb.Append("</ul>")
        End If
        Response.Write(sb)
    End Sub

Then to place it on your webpage you can referance it like this:

<%ProcessRSS("http://feeds.rapidfeeds.com/27057/", "Regpro")%>

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>