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 fso, outFile Set fso = CreateObject("Scripting.FileSystemObject") Set outFile = fso.CreateTextFile("output.txt", True) set rss = CreateObject("Chilkat.Rss") ' Download from the feed URL: success = rss.DownloadRss("http://blog.chilkatsoft.com/?feed=rss2") If (success <> 1) Then MsgBox rss.LastErrorText WScript.Quit End If ' Get the 1st channel. Set rssChannel = rss.GetChannel(0) If (rssChannel Is Nothing ) Then MsgBox "No channel found in RSS feed." WScript.Quit End If ' Display the various pieces of information about the channel: outFile.WriteLine("Title: " & rssChannel.GetString("title")) outFile.WriteLine("Link: " & rssChannel.GetString("link")) outFile.WriteLine("Description: " & rssChannel.GetString("description")) ' For each item in the channel, display the title, link, ' publish date, and categories assigned to the post. numItems = rssChannel.NumItems For i = 0 To numItems - 1 Set rssItem = rssChannel.GetItem(i) outFile.WriteLine("----") outFile.WriteLine("Title: " & rssItem.GetString("title")) outFile.WriteLine("Link: " & rssItem.GetString("link")) outFile.WriteLine("pubDate: " & rssItem.GetString("pubDate")) numCategories = rssItem.GetCount("category") If (numCategories > 0) Then For j = 0 To numCategories - 1 outFile.WriteLine(" category: " _ & rssItem.MGetString("category",j)) Next End If Next outFile.Close |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.