|  | 
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
| (VBScript) Read RSS FeedNote: This example uses classes, properties, or methods discontinued in Chilkat v11.0.0 or greater. Sample code showing how to read an RSS feed and emit the contents. 
 Dim fso, outFile Set fso = CreateObject("Scripting.FileSystemObject") 'Create a Unicode (utf-16) output text file. Set outFile = fso.CreateTextFile("output.txt", True, True) ' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Rss") set rss = CreateObject("Chilkat.Rss") ' Download from the feed URL: success = rss.DownloadRss("http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml") If (success <> 1) Then outFile.WriteLine(rss.LastErrorText) WScript.Quit End If ' Get the 1st channel. ' rssChannel is a Chilkat.Rss Set rssChannel = rss.GetChannel(0) If (rss.LastMethodSuccess = 0) Then outFile.WriteLine("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 ' rssItem is a Chilkat.Rss 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-2025 Chilkat Software, Inc. All Rights Reserved.