homepage Welcome to WebmasterWorld Guest from 54.161.192.61
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

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

10+ Year Member



 
Msg#: 3462 posted 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

10+ Year Member



 
Msg#: 3462 posted 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

10+ Year Member



 
Msg#: 3462 posted 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

10+ Year Member



 
Msg#: 3462 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved