Welcome to WebmasterWorld Guest from 54.90.204.233

Forum Moderators: bill & werty

Message Too Old, No Replies

Help me......Losin' it here...feeling woozy...

Need a CGI RSS Parser

     
10:22 pm on Aug 15, 2005 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2005
posts:3
votes: 0


I am trying to get news feeds to work on my website. I do not know anything about them so I have been reading around. Anyhow....I think I would like to have a cgi-bin rss feed. I want it to look like the content was provided by my site not by someone else..I also want search engines to see my contents so java is out.

Can some one help me?

4:40 am on Aug 16, 2005 (gmt 0)

Moderator This Forum from US 

WebmasterWorld Administrator 10+ Year Member

joined:Dec 3, 2002
posts:1934
votes: 13


Adva, welcome to Webmasterworld [webmasterworld.com].

The only RSS parse in CGI that I know is:
[decafbad.com...]

Others like Magpie or Carp are written in PHP.

3:43 am on Aug 19, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 20, 2004
posts:2377
votes: 0


If you have Linux/Unix, login via SSH or Telnet and try the following:

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>";

3:49 am on Aug 19, 2005 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2005
posts:3
votes: 0


Is that English? SO SORRY...I am not getting it. I will try to go over your post step by step and see if I can figure it out. IS there any possible way I can get you to help me?

Thanks so much!

3:51 am on Aug 19, 2005 (gmt 0)

New User

10+ Year Member

joined:Aug 15, 2005
posts:3
votes: 0


Thank you for the warm welcome! I am trying to design the site myself.

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]

8:55 am on Aug 19, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Mar 7, 2003
posts:301
votes: 0


I havent tried it but this may help.
It generates a javascript that lets you use the feed.
[jade.mcli.dist.maricopa.edu...]