Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX 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. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% set rss = Server.CreateObject("Chilkat.Rss") ' Download from the feed URL: success = rss.DownloadRss("http://blog.chilkatsoft.com/?feed=rss2") If (success <> 1) Then Response.Write rss.LastErrorText & "<br>" End If ' Get the 1st channel. Set rssChannel = rss.GetChannel(0) If (rssChannel Is Nothing ) Then Response.Write "No channel found in RSS feed." & "<br>" End If ' Display the various pieces of information about the channel: Response.Write Server.HTMLEncode( "Title: " _ & rssChannel.GetString("title")) & "<br>" Response.Write Server.HTMLEncode( "Link: " _ & rssChannel.GetString("link")) & "<br>" Response.Write Server.HTMLEncode( "Description: " _ & rssChannel.GetString("description")) & "<br>" ' 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) Response.Write Server.HTMLEncode( "----") & "<br>" Response.Write Server.HTMLEncode( "Title: " _ & rssItem.GetString("title")) & "<br>" Response.Write Server.HTMLEncode( "Link: " _ & rssItem.GetString("link")) & "<br>" Response.Write Server.HTMLEncode( "pubDate: " _ & rssItem.GetString("pubDate")) & "<br>" numCategories = rssItem.GetCount("category") If (numCategories > 0) Then For j = 0 To numCategories - 1 Response.Write Server.HTMLEncode( " category: " _ & rssItem.MGetString("category",j)) & "<br>" Next End If Next %> </body> </html> |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.