CDB cat dog-egories:

May 07, 2003

RSS to JS examples+code

To follow up on the RSS in Blackboard piece, I have posted a new page that documents and demos RSS to JS along with the source PHP code.

This is pretty crude stuff, but anyone could more or less have one or more RSS feeds into any web site, WebCT, Blackboard, blog page without getting their fingers into messy XML.

It is just a line of JavaSCript that references a PHP script on my server, passing it as a parameter the URL for the RSS feed. The script returns a series of JavaScript commands that output the results to the page.

Toss in some CSS and you can pretty it as you please. Thanks to D'Arcy Norman for cleaning up some bits of the PHP code.

All PHP is provided for those that want to run it themselves.

One reason to possibly run your own parses is you could easily add a logging capability. Hmmmm

blogged May 7, 2003 04:26 PM :: category [ rss ] :: TrackBack

I downloaded the zip file and put it in my web site directory in a folder called "feed". Then I set the web page code to

Doesn't work. Maybe it is rocket science.

Rick Bateman

Posted by: Rick Bateman at May 12, 2003 05:18 PM

You should first make sure your web site host supports PHP.

Then you should test your PHP script by executing it as a URL in your web browser, e.g., the site you attempted, works on my script:

Finally, in the code you sent me:

<script language="JavaScript" src="rss2js.php?
src="> </script>

will only work if you call it from a web page in the same directory as your PHP script, ideally you would issue a FULL url that points to your script:

<script language="JavaScript" src="
src="> </script>

This is experimental, free, so some leg work is going to be on your end.

Posted by: Alan at May 12, 2003 08:59 PM

Well, I tried everything and everything is as you say it should be but it still only works when I use the URL so it must be something else about my ISP's server config. I even tried the FTP permissions.

I was mainly interested in this to share it with my local RSS group but it does not seem to be as "no brainer portable" as I hoped.

Thanks anyway.

Posted by: Rick Bateman at May 12, 2003 09:45 PM

I am guessing Rick, your issue is with PHP global settings being OFF on your server, and the way I had written the code did not address this.

I have made an update of the code (blogged) to try and take care of this, as well as add some display options mentioned by Randy Brown.


Posted by: Alan at May 13, 2003 11:31 AM
Spammers Have Force Our Hands...
Note: Those nasty blog-spamming roaches have forced us to take action to prevent their spread- all entries made to this nlog will remain open only for 30 days within their original posting date.

If you really need to make contact with the chief dog around here, please submit a request via our feedback center