Welcome to WebmasterWorld Guest from 54.197.66.254

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl & XML RSS

Using Perl for Fetching XML RSS Feeds

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

New User

10+ Year Member

joined:Mar 29, 2003
posts:33
votes: 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.

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

Preferred Member

10+ Year Member

joined:Dec 30, 2003
posts:428
votes: 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

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

New User

10+ Year Member

joined:Mar 29, 2003
posts:33
votes: 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.

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

Preferred Member

10+ Year Member

joined:Dec 30, 2003
posts:428
votes: 0


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

Sean

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members