Forum Moderators: open
Can some one help me?
The only RSS parse in CGI that I know is:
[decafbad.com...]
Others like Magpie or Carp are written in PHP.
shell> perl -MCPAN -e shell
cpan> install XML::RSS
This will install an XML RSS parser. Then you can use the following in your CGI (Perl) program:
#!/usr/bin/perl
# import packages
use XML::RSS;
use LWP::Simple;
# initialize object
$rss = new XML::RSS();
# get RSS data
$raw = get('http://www.slashdot.org/index.rss');
# parse RSS feed
$rss->parse($raw);
# print HTML header and page
print "Content-Type: text/html\n\n";
print "<html><head><basefont face=Arial size=8></head><body>"; print "<table width=300 border=1 cellspacing=0 cellpadding=5>"; print "<tr><td align=center bgcolor=Silver>" . $rss->channel('title') .
"</td></tr>";
print "<tr><td>";
# print titles and URLs of news items
foreach my $item (@{$rss->{'items'}})
{
$title = $item->{'title'};
$url = $item->{'link'};
print "<a href=\"$url\">$title</a><p\>"; }
# print footers
print "</td></tr>";
print "</table>";
print "</body></html>";
If you want to see it:
<Sorry, no personal URLs.
See Terms of Service [webmasterworld.com]>
Be nice :-) I have designed it myself and am trying to get it finished.
[edited by: tedster at 3:05 pm (utc) on Aug. 19, 2005]