This topic has been closed for further discussion.
Scarlett wrote:
I had actually added the space, trying to make it work..no space version online now. Still doesn't work.
Scarlett,
Let's go to the very, very basics here. Backup the file, delete everything, and just type this:
Code:
<?php echo "Hello World"; ?>
Does that work? (trying to eliminate a problem with your host)
Today's article: A Unique Look at Adwords Advertising
Guys I wrote an article for my site on this subject a while back http://www.webmastertips.us/tutorials/rss-feeds.htm
Basically I talk about using a program called Carp to pull in newsfeeds and then you can use a SSI Include to put it your news feed into a html page. http://www.webmastertips.us/tutorials/ssi-include.htm
Using Carp makes it pretty easy.
Member
From: Sydney, Australia
Registered: 2004-10-23
Posts: 593
I've been thanked 0 times.
Offline
Dear me...people.
I wrote a similar tutorial 12 months ago in these very pages...
No second prizes for parrots!
(Of course, I jest) 

Great article, mate 
I cried because I had no shoes - until I saw a man who had no feet...
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2085
I've been thanked 5 times.
Offline
Wizard of Oz wrote:
Dear me...people.
I wrote a similar tutorial 12 months ago in these very pages...
No second prizes for parrots!
(Of course, I jest)
Great article, mate
thanks! well they say there is nothing new under the sun
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
Member
From: Sydney, Australia
Registered: 2004-10-23
Posts: 593
I've been thanked 0 times.
Offline
Mutilated1 wrote:
Wizard of Oz wrote:
Dear me...people.
I wrote a similar tutorial 12 months ago in these very pages...
No second prizes for parrots!
(Of course, I jest)
Great article, matethanks! well they say there is nothing new under the sun
Too true (but I want MY ROYALTIES) 


I cried because I had no shoes - until I saw a man who had no feet...
Yes...as I mentioned I have other php pages on the site...ie., http://www.all-about-planters.com/signup.php
Is it a PHP version issue?
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2085
I've been thanked 5 times.
Offline
Well I saw your /phpscripts directory on your server, but I never saw the file get uploaded there.
Seriously, all you have to do is upload the file.
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
Copy this file (http://www.scary-software.com/RSS/SimpleReader.phps) into a text editor. Save it as something like 'reader.php', and upload it to a directory on your server. MAKE SURE it ends up in the right directory. Once you upload it, let us know where you put the file and we can trouble shoot from there.
Today's article: A Unique Look at Adwords Advertising
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2085
I've been thanked 5 times.
Offline
SiteReference wrote:
Copy this file (http://www.scary-software.com/RSS/SimpleReader.phps) into a text editor. Save it as something like 'reader.php', and upload it to a directory on your server. MAKE SURE it ends up in the right directory. Once you upload it, let us know where you put the file and we can trouble shoot from there.
Even better.... Right click on SiteReference's link. Choose Save As...
Then save the file on your PC. Then rename the end of the file so that instead of phps it ends with php.
Upload it to your phpscripts folder you made earlier
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
Hi
I think some thing is being missed here. When you use php and the "include" function you need to add some code to your htaccess file to let your browser know to use PHP. I use the include in one of my sites and had to add this code to my htaccess before it would work.
Options All -Indexes
AddHandler php-script .html
#AddHandler application/x-httpd-php .htm .html
<Files ".ht*">
order allow,deny
deny from all
</Files>
It may be different for each application.
I hope this can be made to work. I have been looking for a long time for a way to convert RSS to html.
Right, that's if you are trying to integrate PHP code into an established .html page and don't want to change the extension to PHP...
Today's article: A Unique Look at Adwords Advertising
Ok, thats what I want to do here. Will the code I already have work or will this not work with an HTML page. If It will work, what do I need to add to my htaccess file?
Bob
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2085
I've been thanked 5 times.
Offline
If you want to put this PHP code in a regular HTML page then there are at least two ways you could go about it.
The first and most direct way would be to use the Add Handler directive in your .htaccess so that a .htm or .html file is treated like a PHP file. To do that add some code like this to your .htaccess
Code:
RemoveHandler .html .htm AddType application/x-httpd-php .php .phtml .htm .html
Only thing is that some installations of Apache and PHP will not allow you to do that, and if thats the case then you'll have to rename the file to .PHP but in order so you can rename the file .PHP without breaking all your links to the file you'll want to write a rule so that if asked for filename.html, Apache will look for filename.php first and use it if its there
If you change the filename to .php instead of .html then do this in your .htaccess file so that your existing links won't break
Code:
RewriteEngine on
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1]
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.htmlTombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
Code:
Warning: fopen(76a708b5c7e3258dfb580bae37c615a2): failed to open stream: Permission denied in /home/simba/public_html/feeds/rssreader.php on line 38 Warning: fwrite(): supplied argument is not a valid stream resource in /home/simba/public_html/feeds/rssreader.php on line 39 Warning: fclose(): supplied argument is not a valid stream resource in /home/simba/public_html/feeds/rssreader.php on line 40
I have just upgraded to the advanced rss reader and am getting the above error. The files are CHMODed to 777 and i cant have it work. What am i doing wrong?:|
Thanks
Yeah that works but the advanced version is different i think...i tried commenting out the part that writes from the cache and it went haywire on me...pheeuks..some script huh?
Kwezi,
Post your code here so I can look at it...
Today's article: A Unique Look at Adwords Advertising
its here SR
Code:
<?php
//
// ScarySoftware RSS parser
// Copyright (c) 2006 Scary Software
// ( Generates HTML from a RSS feeds )
//
// Licensed Under the Gnu Public License
//
class rssReader {
var $rssFeeds;
// Class constructor
function rssReader() {
// Here are the feeds - you can add to them or change them
$this->rssFeeds = array(
0 => "http://www.site-reference.com/xml.php?c=all",
1 => "http://rss.cnn.com/rss/cnn_topstories.rss",
2 => "http://rss.slashdot.org/Slashdot/slashdot",
);
}
function checkCache($rss_url) {
$ttl = 60*60;// 60 secs/min for 60 minutes = 1 hour(360 secs)
$cachefilename = md5(md5($rss_url));
if (file_exists($cachefilename) && (time() - $ttl < filemtime($cachefilename)))
{
$feed = file_get_contents($cachefilename);
}
else
{
$feed = file_get_contents($rss_url);
$fp = fopen($cachefilename, 'w');
fwrite($fp, $feed);
fclose($fp);
}
return $feed;
}
// return $feed;
// }
//
// Creates HTML from a FeedID in the array
// it makes $howmany entries
//
function createHtmlFromFeed($feedid, $howmany) {
// Now we make sure that we have a feed selected to work with
$rss_url = $this->rssFeeds[$feedid];
if (!isset($rss_url)) $rss_url = $this->rssFeeds[$feedid];
$howmany = intval($howmany);
$this->createHtmlFromRSSUrl( $rss_url, $howmany );
}
//
// Create HTML from an RSS URL
// it makes $mowmany entires
//
function createHtmlFromRSSUrl( $rss_url, $howmany )
{
// Now we get the feed and cache it if necessary
$rss_feed = $this->checkCache($rss_url);
// Now we replace a few things that may cause problems later
$rss_feed = str_replace("<![CDATA[", "", $rss_feed);
$rss_feed = str_replace("]]>", "", $rss_feed);
$rss_feed = str_replace("\n", "", $rss_feed);
// Now we get the nodes that we're interested in
preg_match_all('#<title>(.*?)</title>#', $rss_feed, $title, PREG_SET_ORDER);
preg_match_all('#<link>(.*?)</link>#', $rss_feed, $link, PREG_SET_ORDER);
preg_match_all('#<description>(.*?)</description>#', $rss_feed, $description, PREG_SET_ORDER);
//
// Now that the RSS/XML is parsed.. Lets Make HTML !
//
// If there is not at least one title, then the feed was empty
// it happens sometimes, so lets be prepared and do something
// reasonable
if(count($title) <= 1)
{
echo "No news at present, please check back later.<br><br>";
}
else
{
// OK Here we go, this is the fun part
// Well do up the top 3 entries from the feed
for ($counter = 1; $counter <= $howmany; $counter++ )
{
// We do a reality check to make sure there is something we can show
if(!empty($title[$counter][1]))
{
// Then we'll make a good faith effort to make the title
// valid HTML
$title[$counter][1] = str_replace("&", "&", $title[$counter][1]);
$title[$counter][1] = str_replace("'", "'", $title[$counter][1]);
$title[$counter][1] = str_replace("£", "£", $title[$counter][1]);
// The description often has encoded HTML entities in it, and
// we probably don't want these, so we'll decode them
$description[$counter][1] = html_entity_decode( $description[$counter][1]);
// Now we make a pretty page bit from the data we retrieved from
// the RSS feed. Remember the function FormatRow from the
// beginning of the program ? Here we put it to use.
$row = $this->FormatEntry($title[$counter][1],$description[$counter][1],$link[$counter][1]);
// And now we'll output the new page bit!
echo $row;
}
}
}
}
function FormatEntry($title, $description, $link) {
return <<<eof
<!-- RSS FEED ENTRY -->
<span class="feeds_head">$title<br>
<span class="feeds_desc">$description<br><br>
<a class="newsmore" href="$link" rel="nofollow" target="_blank">Read more...</a>
<br>
<hr size=1><br>
<!-- END OF RSS FEED ENTRY -->
eof;
}
function GetrssFeeds() {
return $this->rssFeeds;
}
function SetrssFeeds($rssFeeds) {
$this->rssFeeds = $rssFeeds;
}
}// END OF THE CLASS
?>SR the page looks like this...http://simbahosting.net/news.php
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2085
I've been thanked 5 times.
Offline
travelagent wrote:
I tried the advanced version, but didn't see any significant changes -- what I'd like for someone to answer is this ... why don't all of these feeds appear on my page?
Code:
0 => "http://news.google.com/news?ned=us&topic=h&output=rss", 1 => "http://rss.cnn.com/rss/cnn_travel.rss", 2 => "http://www.abblogger.com/rss.php?u=airlines", 3 => "http://asp.usatoday.com/marketing/rss/rsstrans.aspx?feedId=travel1", 4 => "http://www.foxnews.com/xmlfeed/rss/0,4313,3,00.rss", 5 => "http://www.washingtonpost.com/wp-dyn/rss/linkset/2005/04/18/LI2005041801007.xml", 6 => "http://www.nytimes.com/services/xml/rss/nyt/Travel.xml",
Because when you use the advanced reader version, the number part of the array is used to select the URL to the feed you choose. This is just for convience so you can easily choose which feed to display
For example
Code:
<?php
include("Reader.php");
$myRSS = new rssReader();
$myRSS->createHtmlFromFeed(
0, // Use Feed ID #0
5 // and make 5 entries
);
$myRSS->createHtmlFromFeed(
1, // Use Feed ID #1
3 // and make 3 entries
);
?>@kwezi - if you're still having problems with the lines that are supposed to write the cache file, you can just delete them if you want. If you're getting a white screen with text on it at all, you could have deleted something you shouldn't.
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
kwezi wrote:
SR the page looks like this...http://simbahosting.net/news.php
Kwezi,
I actually did see text. I think what is happening for you is that there is an error right now (its trying to write to a file that it doesn't have permission to write to) and is located inside of a table. Because its inside of a table, it has to wait for the content to load, which isn't happening right away due to the error.
If you can just get that permissions error ironed out, it will be fine.
Today's article: A Unique Look at Adwords Advertising
| Never |



