Link to home
Start Free TrialLog in
Avatar of OmniUnlimited
OmniUnlimitedFlag for United States of America

asked on

How to update RSS feed

Hello Experts,

I have a question:  I have a site that has an RSS feed.  I did not design the site, and truth be known, I know next to nothing about RSS.  I've done some reading, but I still don't have a concept as to how to be able to update the feed immediately when I update the content.  Can anyone give me some guidance on this?
Avatar of smeghammer
smeghammer
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you using some sort of CMS? If so, does this CMS automate your RSS output based on changed content?

It is difficult to answer without more info on what your site does to generate the RSS.

RSS basically is XML based. The data (headline, text, link, image etc.) are wrapped in the XML markup of a specific format which defines it as RSS. The actual data will often come from  existing content, such as from a HTML page, or a news feed (the same data being presented in different formats). Usually, some code re-purposes the existing data from - eg - the HTML page, and wraps it in the RSS XML tags, and exposes it as part of an RSS feed document. This process may be part of a CMS, or some custom bits of code.

From your PoV, we need to know what it is that generates the RSS from your page data. It could even be manual...
Avatar of OmniUnlimited

ASKER

Ha, good question.  As I said, I did not design this site.

No, this is not a CMS.  This is a custom site built from the ground up in PHP.

How do I figure out how the RSS is being done?
Avatar of Bernard Savonet
Could you provide us with the url for the site or of the RSS, if it is public?
This would probably give some clue at which program is generating the feed
Some where in your site is a php script that creates file that are RSS compliant.  For most sites there is a CRON job that automatically picks up new content and generates updated versions of the feed at regular intervals.

The setup and generation is relatively easy.  This basic RSS how to might help you work it out.


Cd&
Hello Experts, my deepest apologies for not getting back to you sooner.  I posted this question, a few hours later an expert answered, I responded that same day and did not hear anything for five days.  Well, in the meantime, life goes on and I got busy with another project.

Thanks to all who responded.

@fibo - I'm sorry, I cannot disclose the url for the site.

@COBOLdinosaur - Yes, you are right, there is a php file that extracts information from the database and sets it into XML coding and saves it to the root.  It is not a cron job, however, but is set up to produce the file each time the RSS feed icon is clicked.

@Ray_Paseur - As always, a very informative article, Ray.  In it, you mentioned that the feeds are normally consumed by a feed reader.  Now, when I click on the RSS feed on the site, it takes me to an RSS page http://www.example.com/rss/feed.  This page (if I am following the .htaccess file right) points to the file I mentioned to COBOLdinosaur above.  The file seems to take information live from the database, but when I click on the link, old information is displayed for at least two hours after it is updated.  Do you know of any way I can force its immediate update? (I clear browser cache and history each time, by the way.)
At the beginning you wrote, "I have a site that has an RSS feed."  And we responded, "Could you provide us with the url for the site or of the RSS?"  I am fairly sure you do not control http://www.example.com/rss/feed, so we are working with incomplete information and it is hard to answer your question without specifics.

What specific information can you give us?  We are experts but not mind readers.  If you cannot disclose the URL for the site, I suggest you set up a test site and put a mirror copy of the "secret site" on it so we can show you how to do mock-object testing.  Then we will be able to help.  See AntiPractice #3.
@Ray: Hello Ray, and thanks again for your response.  Yes, as you astutely surmised, http://www.example.com/rss/feed is a sanitized version of the real url (which is exactly the same except for the domain name.)  While I agree that it is hard to work without specifics, security constrains me to not reveal any details of the site (not that this is a super secret site, it is just that I am under contractual agreement not to do so.)

I'm afraid that I am limited as to what specifics I can give you.  Although I can duplicate the PHP coding on a test site as you proposed, if the site I am trying to update (my example.com site) is as you mentioned running off an RSS Feed Reader, I have no clue as to what that reader is.

Is the secret to whether or not the information on the RSS Feed can be updated immediately or not dependant on the RSS Feed Reader?  If so, is there any way, just by examining the site, I could determine what the reader is?
OK, let's try to deconstruct the terminology here.  

An RSS feed is a specialized XML document.
http://cyber.law.harvard.edu/rss/rss.html

There are two parties to the RSS feed.  The party that creates the RSS XML document and puts it on a publicly available URL is the RSS publisher.  The party that looks at the RSS document is the RSS consumer.  The consumer can use a web browser for a one-time view of the RSS document.  Or the consumer can install an RSS reader program.

The RSS consumer will give the RSS reader program the URL of a feed.  The RSS reader program will go and get a snapshot of the RSS XML document and store the snapshot.  Then the RSS reader program will "sleep" for some predefined time interval.  When it wakes up, it will go to the URL, get another snapshot of the RSS XML document and compare that to the old snapshot.  It there is any difference, the reader program will alert the RSS consumer.   Then it will go back to sleep until its next interval.  Later rinse repeat, forever or until the RSS consumer kills the RSS reader program.

So you're really at the mercy of the RSS publisher, who controls the content and timing of the updates to the XML document.
@Ray:  Ahah!  Ok, so you ARE saying that RSS updatability is not dependant on the website, but on the reader?  What about in the case of the consumer that uses the web browser?  How can I cause that to be updated immediately?  (As I mentioned, it appears that the XML is updated instantly when the database is updated.)

BTW, I forgot to mention, that Antipractice #3 article was really good.  I can see you work to keep up-to-date with the latest practices.
How can I cause that to be updated immediately?
The short answer is, "You can't."  The timing of the update is entirely up to the publisher of the RSS feed.  If the publisher updates the feed every two hours, that's as frequently as the XML document will change.  If the publisher updates the feed on the basis of some kind of external synchronization signal, the XML document may change very quickly or not at all for several days.  It all depends on the publisher.
@Ray: But, I am the publisher of the RSS feed, i.e. I am the one updating the content (which in turn gets updated in the database) which the page that produces the XML code uses to update the XML file.  Now I can update the XML file immediately, but when I try and view the XML file through the http://www.example.com/rss/feed url, I see old information for about two hours.  So I take it that updating the XML file is not the same as updating the RSS feed?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Ray, you did it again.  I had been clearing the cache which I assumed was taking care of the cached web pages, but it turns out that it wasn't.  Your comment made me go back and look again to discover the problem.
Excellent!  Thanks for the points; glad I was able to help. ~Ray
Hi, Apologies for not following up on this - I was on holiday with no access to internet. Glad it was resolved though. Cheers.