RSS Feed Using PHP



Im relatively new to scripting and have been using canned ones from a site called Dynamic Drive.

No matter what I do, I cannot get this feed to work for me.
Nor does the demo.htm work for me.

The script is at:

I have made sure to point to the rsspausescoller file on my website.
I have made sure to point to the PHP file in /lastRSS

The error message I get is:
Sorry: It’s not possible to reach RSS file
I give up trying to fetch RSS feed.

Please…does anyone know what I am doing wrong?
Is there something in Dreamhost that requires me to unlock the cache directory or do something I am not doing?

Thanks in advance.



It may be that the feed is not available or is at a different location. Give it a couple of days and see if it works.

Sometimes these scripts use /tmp as the temp and your script may need some adjustment if it cannot access /tmp. There have been instances when the temp folder was not set up correctly by DreamHost (allegedly) so that may be a point to ponder also.


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


It may be that the canned script is attempting to fetch the feed using the full URL (anything beginning with http://). For security reasons, DreamHost has disabled a feature called “URL file access”, so any canned script that relies on this feature will not work.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


Thank you for your responses.
I have a feeling it is something peculiar to Dreamhost, which is why I asked here.

It works on the dynamic drive site, and it works for other people on their sites, for example:

When I try to even run the demo, AS IS, it wont work.

I tried it both ways, with the url specified as is -

and the way they suggest:

var bridgepath=“

and neither way works. I assume Dreamhost disables something.

I also had problems with a PHP-CGI form:

I am really baffled guys- usually I can get these scripts to work for me!

Thanks for all your help!



Your script is probably using “fopen()” or similar, and these are disabled by DreamHost. DreamHost claims cURL is faster and safer,

$97.00 off all yearly DreamHost signups, use code JED


Thanks very much!

I didnt write this script, nor do I know how to, or to correct the problem, but I will read the information and see if there isnt something I can do.

Apparently, these commands will disable any such script run on Dreamhost.



Thanks to you, Jack, I have located the problem and am posting it here to alert others.

"This script works by first relying on a simple PHP RSS parser called LastRSS to retrieve/cache an RSS feed. "

When I searched LastRSS, I indeed found the “fopen” commands that you speak about:

if ($f = @fopen($cache_file, ‘w’)) {

if ($f = @fopen($rss_url, ‘r’)) {

If these commands are disabled, it well explains why this doesn’t work. I will attempt to substitute cURL commands as per the wikipedia article.

Many thanks for helping!!



I hope you’ll post some workaround code that can be substituted for “fopen()”.

$97.00 off all yearly DreamHost signups, use code JED


I’m not a programmer, so I frankly do not know how to fix up this canned RSS feed script, however, there is a workaround I found at:

"When the change was first made, a number of my scripts broke – but honestly, it was only a couple minute fix. Tell the extension developer to give -you- a break, fopen is not necessary to get remote files and is rather weak compared to curl.

Here’s a php class I use to get remote files as strings – feel free to pass it on to that developer. "

class curl {
var $timeout;
var $url;
var $file_contents;
function getFile($url,$timeout=0) {

use CURL library to fetch remote file

$ch = curl_init();
$this->url = $url;
$this->timeout = $timeout;
curl_setopt ($ch, CURLOPT_URL, $this->url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
$this->file_contents = curl_exec($ch);
if ( curl_getinfo($ch,CURLINFO_HTTP_CODE) !== 200 ) {
return('Bad Data File '.$this->url);
} else {
return $this->file_contents;


Hmmm. I’m guessing this is potentially the source of some problems I’m having with some of the plugins for Wordpress. However, when I’ve grepped through the plugin files for any fopen or include operations, I’ve come up with no matches. Are there other directives that are being tripped with the allow_url_fopen being turned off? I looked through the dreamwiki info, but didn’t see anything other than fopen and include listed…?