Welcome to WebmasterWorld Guest from 54.147.20.131

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl & XML RSS

Using Perl for Fetching XML RSS Feeds

     

CustomFit

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

10+ Year Member



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

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

10+ Year Member



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

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

10+ Year Member



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

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

10+ Year Member



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

Sean

 

Featured Threads

Hot Threads This Week

Hot Threads This Month