homepage Welcome to WebmasterWorld Guest from 50.17.107.233
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Perl & XML RSS
Using Perl for Fetching XML RSS Feeds
CustomFit




msg:430249
 12:02 am on Feb 9, 2004 (gmt 0)

Hi, does anyone have a Perl code snippet for fetching an Webmasterworld.com's XML RSS feed to display on our site?

Thanks in advance.

 

SeanW




msg:430250
 3:00 pm on Feb 9, 2004 (gmt 0)

Is the problem getting it or parsing it?

OTTOMH:

Get the content:
[perl]
use LWP::Simple;

my $feed = get "http://www.webmasterworld.com/index.rss";
[/perl]

Parse the content:

[perl]
use XML::RSS;
my $rss = new XML::RSS;
$rss->parse($feed);
foreach my $item (@{$rss->{'items'}}) {
print "title: $item->{'title'}\n";
print "link: $item->{'link'}\n\n";
}
[/perl]

Updated: fixed missing quote

CustomFit




msg:430251
 7:54 pm on Feb 11, 2004 (gmt 0)

Sean, the problem isn't getting it so much as it is parsing the data properly. We feel our hands are kind of tied using Perl for styling and arranging the fetched data. Any suggestions on this?

Thanks again.

SeanW




msg:430252
 8:01 pm on Feb 11, 2004 (gmt 0)

That snippet of XML::RSS should be a good start... It takes care of all the parsing.

Sean

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved