Page 1 of 1

Parameters to RSS Feed ?

Posted: Tue Feb 22, 2005 5:05 am
by anjanesh
Lets say I have in my site word of the day like :
http://dictionary.reference.com/wordoftheday/wotd.rss
Is it possible for me to have another rss feed (meaning.rss) where I give a paramater (meaning.rss?word=hello) which will return the meaning of the word in xml (rss) ?
Thanks

Posted: Tue Feb 22, 2005 5:13 am
by n00b Saibot
Hey, this doesn't belong to PHP-Code does it :x

Posted: Tue Feb 22, 2005 5:27 am
by anjanesh
Im pretty sure it does because my question relates to generation of RSS Feeds using PHP.

Posted: Tue Feb 22, 2005 5:38 am
by n00b Saibot
anjanesh wrote:because my question relates to generation of RSS Feeds using PHP.
You didn't mention that before. :roll:
Well, lets see. you want to have a meaning.rss to which you can pass a parameter. You see the fact is RSS is a fixed xml format so it can't just dynamically sort out a meaning.
Maybe you would like to change the target from meaning.rss to meaning.php ;)

Posted: Tue Feb 22, 2005 5:46 am
by anjanesh
meaning.php (or meaning.php.rss as this seems to be pasing php) - and output in pure XML format.
But will this validate in a RSS validator and the most important - can other people include these php files ?
If RSS is a fixed xml format then how to sites update things like Latest News, Quote of the Day etc - Im pretty sure they don't manually update - any PHP code within rss ?

Posted: Tue Feb 22, 2005 5:53 am
by n00b Saibot
Methinks they just have rss generators which update the rss files with the updated content. And Yes if the RSS you generate is valid, it can be read by any RSS Reader. :)

Posted: Tue Feb 22, 2005 8:56 am
by Buddha443556
I think your overlooking one thing. The RSS readers, which checks one address again and again and again. Is the user going to have to update the address every day for the new word meaning? Sort of negates the benefits of using RSS.

You can use PHP to create a "word of the day" RSS feed. It could give the last seven days words in word.rss (or word.php as long as you return the right content-type for RSS readers) with each of the words linked to meaning.php?word=X. This has the added bonus that they return to your site for the meaning thereby developing return traffic. :D

Posted: Tue Feb 22, 2005 9:05 am
by anjanesh
Buddha443556 wrote:or word.php as long as you return the right content-type for RSS readers
Thanks Budda. So content-type for RSS readers works if the extension is a .php containing php code. That was what I wanted to know.

Posted: Tue Feb 22, 2005 10:06 am
by Buddha443556
anjanesh wrote:
Buddha443556 wrote:or word.php as long as you return the right content-type for RSS readers
Thanks Budda. So content-type for RSS readers works if the extension is a .php containing php code. That was what I wanted to know.
The only time I've had trouble with PHP feeds are when they return the wrong content-type. Some readers are more strict than others. As for which one is the right content-type ... well that's a good question? I've been using: application/rss+xml with RSS 0.92.

There's a drew back to using file extension PHP as browsers like Firefox can't find them for the live bookmark indicator. Cron'ing the RSS feed is better for this reason but you could process your RSS files as PHP or do a server side redirect to the php file.

Posted: Tue Feb 22, 2005 10:16 am
by anjanesh
Regarding Cronning : what if theres a news feed that keeps updating minute by minute - In that case definitely news.php.rss would be better than to cron a news.rss file - every one minute a cron takes place - doesnt look good.

Posted: Tue Feb 22, 2005 10:51 am
by Buddha443556
anjanesh wrote:Regarding Cronning : what if theres a news feed that keeps updating minute by minute - In that case definitely news.php.rss would be better than to cron a news.rss file - every one minute a cron takes place - doesnt look good.
It's not how often your news updates that should determine your method of production but the traffic on the feed. Feeds can generate a lot of traffic because they are checked automatically by RSS readers some of which are crap. So if your feed is low traffic fry (php.rss) or bake (cron) it when traffic becomes a problem bake it or throw more hardware at it.

Posted: Mon Mar 14, 2005 3:02 pm
by anjanesh
I gave these two in the first 2 lines :

Code: Select all

header("Content-type: application/rss+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
FF keeps showing the download box - its not showing the xml file.

Posted: Tue Mar 15, 2005 2:51 pm
by Ambush Commander
What you can also do is create a php script that, when it runs, overwrites a different .rss file. Or you could configure to parse rss files for PHP. Two ways to keep the right filetype (although I prefer the former)