Forum Moderators: open

Message Too Old, No Replies

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

Need a CGI RSS Parser

         

adva

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

10+ Year Member



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?

werty

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

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



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.

maximillianos

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

WebmasterWorld Senior Member 10+ Year Member



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

adva

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

10+ Year Member



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!

adva

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

10+ Year Member



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]

David_M

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

10+ Year Member



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