Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Read RSS FeedSample code showing how to read an RSS feed and display the contents. The Chilkat RSS class/component is freeware. Note: The Chilkat XML ActiveX also includes the Chilkat RSS and Atom components. Dim rss As New ChilkatRss Dim success As Long ' Download from the feed URL: success = rss.DownloadRss("http://blog.chilkatsoft.com/?feed=rss2") If (success <> 1) Then MsgBox rss.LastErrorText Exit Sub End If ' Get the 1st channel. Dim rssChannel As ChilkatRss Set rssChannel = rss.GetChannel(0) If (rssChannel Is Nothing ) Then MsgBox "No channel found in RSS feed." Exit Sub End If ' Display the various pieces of information about the channel: Text1.Text = Text1.Text & "Title: " & rssChannel.GetString("title") & vbCrLf Text1.Text = Text1.Text & "Link: " & rssChannel.GetString("link") & vbCrLf Text1.Text = Text1.Text & "Description: " & rssChannel.GetString("description") & vbCrLf ' For each item in the channel, display the title, link, ' publish date, and categories assigned to the post. Dim numItems As Long numItems = rssChannel.NumItems Dim i As Long For i = 0 To numItems - 1 Dim rssItem As ChilkatRss Set rssItem = rssChannel.GetItem(i) Text1.Text = Text1.Text & "----" & vbCrLf Text1.Text = Text1.Text & "Title: " & rssItem.GetString("title") & vbCrLf Text1.Text = Text1.Text & "Link: " & rssItem.GetString("link") & vbCrLf Text1.Text = Text1.Text & "pubDate: " & rssItem.GetString("pubDate") & vbCrLf Dim numCategories As Long numCategories = rssItem.GetCount("category") Dim j As Long If (numCategories > 0) Then For j = 0 To numCategories - 1 Text1.Text = Text1.Text & " category: " _ & rssItem.MGetString("category",j) & vbCrLf Next End If Next |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.