![]() |
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
(PureBasic) 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.
IncludeFile "CkRss.pb" Procedure ChilkatExample() rss.i = CkRss::ckCreate() If rss.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Download from the feed URL: success.i = CkRss::ckDownloadRss(rss,"http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml") If success <> 1 Debug CkRss::ckLastErrorText(rss) CkRss::ckDispose(rss) ProcedureReturn EndIf ; Get the 1st channel. rssChannel.i = CkRss::ckGetChannel(rss,0) If CkRss::ckLastMethodSuccess(rss) = 0 Debug "No channel found in RSS feed." CkRss::ckDispose(rss) ProcedureReturn EndIf ; Display the various pieces of information about the channel: Debug "Title: " + CkRss::ckGetString(rssChannel,"title") Debug "Link: " + CkRss::ckGetString(rssChannel,"link") Debug "Description: " + CkRss::ckGetString(rssChannel,"description") ; For each item in the channel, display the title, link, ; publish date, and categories assigned to the post. numItems.i = CkRss::ckNumItems(rssChannel) i.i For i = 0 To numItems - 1 rssItem.i = CkRss::ckGetItem(rssChannel,i) Debug "----" Debug "Title: " + CkRss::ckGetString(rssItem,"title") Debug "Link: " + CkRss::ckGetString(rssItem,"link") Debug "pubDate: " + CkRss::ckGetString(rssItem,"pubDate") numCategories.i = CkRss::ckGetCount(rssItem,"category") j.i If numCategories > 0 For j = 0 To numCategories - 1 Debug " category: " + CkRss::ckMGetString(rssItem,"category",j) Next EndIf CkRss::ckDispose(rssItem) Next CkRss::ckDispose(rssChannel) CkRss::ckDispose(rss) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.