Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Using RSS

by tmitch (Initiate)
on Feb 17, 2003 at 20:30 UTC ( #236104=perlquestion: print w/ replies, xml ) Need Help??
tmitch has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone, I am trying to implement RSS newsfeed on my site. I need to be able to snatch the XML page so that I can parse it and dynamically display the headline and URL on my site.

I have written the parsing function, and it works fine as long as I manually save the XML page to my machine. However (and bear with me, I'm sure this is elementary), I don't know how to save a remote file to a local server for processing. For example, here is what I've tried:


open (SITE, '') or warn "Error opening location " ;

@site = <SITE> ;

close SITE or warn "Can't close location " ;

print @site ;

I'm sure there is a better way to open/save a remote XML page - and in fact, there may be a better way to implement the RSS altogether. Any suggestions would be greatly appreciated.


Comment on Using RSS
Re: Using RSS
by jasonk (Parson) on Feb 17, 2003 at 20:33 UTC
Re: Using RSS
by ajt (Prior) on Feb 17, 2003 at 21:22 UTC


    To get files off a remote server, you will need to use one of a selection of fine tools. If you want to pulls the files off periodically, then you can use a scheduler such as cron or at, and a standalone executable such as wGet. If you want to get the files and work on them at the same time, then Perl has some excellent tools for this: LWP::UserAgent; LWP::Simple and HTTP::GHTTP.

    Once you have your XML file, you'll want to do something with it. Perl has some excellent tools for this too, including the just updated XML::RSS and my very own XML::RSS::Tools. Either way there are some nice examples and useful links in the documentation of both modules, and there is also useful stuff on

    As it happens I know that the perl-rss crew are planning to update the documents of XML::RSS with some nice links to example articles soon, so you won't have to dig around too much on your own.

    Here is a sneak preview (kellan's suggested list):

    Good luck!

Re: Using RSS
by Steve_p (Priest) on Feb 18, 2003 at 03:51 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://236104]
Approved by jarich
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-11-23 01:10 GMT
Find Nodes?
    Voting Booth?

    My preferred Perl binaries come from:

    Results (127 votes), past polls