Thanks to Mutilated for writing a GREAT little tutorial on parsing RSS with PHP and getting it in your website. If you need help with this tutorial, ask your questions here. Remember, be specific - asking questions like "it doesn't work" will make it hard for us to help you.
Quick and Easy Site Content with RSS and PHP
Today's article: A Unique Look at Adwords Advertising
I tried the SimpleReader.php, saved it as feed2html.php and uploaded it to my site. But when I run it:
http://gain4you.net/feed2html.php
I got these errors:
Code:
Warning: fopen(8c7531e7875a57aec03bfcce19c10161): failed to open stream: Permission denied in /home/gain4y/domains/gain4you.net/public_html/feed2html.php on line 113
Warning: fwrite(): supplied argument is not a valid stream resource in /home/gain4y/domains/gain4you.net/public_html/feed2html.php on line 114
Warning: fclose(): supplied argument is not a valid stream resource in /home/gain4y/domains/gain4you.net/public_html/feed2html.php on line 115
What is wrong?
Good question. Obvioulsy Mutilated1 would be the best person to answer that question, but what I would suggest is including the feed2html.php file in a special directory on your server and setting the permissions of the directory to 777.
Out of curiosity, did you change the $ttl variable at all?
Today's article: A Unique Look at Adwords Advertising
I have heard from a few different SEO experts that RSS feeds may actually hurt your search engine rankings, while other say it's the best way to keep good rankings... The search engines are so unpredictable that I have become very hesitant in implementing any new techniques... Anyone have any input? Thanks...
Kwezi (and anyone else who has this problem)
Two ways to solve the problem...
1. you should place the RSS parsing script in its own folder. For example, create a folder called 'phpscripts'. Then, set the permissions of that folder to "777", or, if you are using a unix file system, rxwrxwrxw (most FTP programs let you do this). This should solve the problem.
2. Don't use the caching - in the rss2html.php file, find the variable '$ttl'. Set that variable to 0 - this will disable the caching. Edit...this actually won't work. See this post to temporarily fix the problem
Let me know if this works
(TA, I get a 404 error - did you delete your page?)
Today's article: A Unique Look at Adwords Advertising
rserpe wrote:
I have heard from a few different SEO experts that RSS feeds may actually hurt your search engine rankings, while other say it's the best way to keep good rankings... The search engines are so unpredictable that I have become very hesitant in implementing any new techniques... Anyone have any input? Thanks...
I don't think that putting an RSS feed on your site will hurt your rankings, but I also really doubt if it helps. Unfortunately I don't have any evidence one way or another to make a good determination. It seems pretty far-fetched, though, to say that it would hurt your rankings.
Today's article: A Unique Look at Adwords Advertising
SiteReference wrote:
Kwezi (and anyone else who has this problem)
Two ways to solve the problem...
1. you should place the RSS parsing script in its own folder. For example, create a folder called 'phpscripts'.
SR Thanks does this include the ____.php file as well or its just the RSS parsing script?
Thank
Just the RSS parsing script...
When you include the 'include' statement, just make sure you have the right path to the file.
Today's article: A Unique Look at Adwords Advertising
Thanks for the script, it worked out pretty easily.
Though I am having a problem with getting feeds from the array
$RSSFEEDS = array(
0 => "http://www.foxnews.com/xmlfeed/blogs/0,4333,,00.rss",
1 => "http://www.site-reference.com/xml.php?c=all",
2 => "http://rss.slashdot.org/Slashdot/slashdot",
);
If I change the 0 below to 1, I get your feed, if I leave it at 0, I get foxnews feed
if (!isset($feedid)) $feedid = 0;
$rss_url = $RSSFEEDS[$feedid];
I even tried changing counter to 50
for ($counter = 1; $counter <= 50; $counter++ )
How do I get all the feeds from the array?
Thanks
wer
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2084
I've been thanked 5 times.
Offline
Yes that would be a better way to do it. Next time, I will try and be more carefull with the instructions.
Putting the script in its own folder would be best.
Also, when you make your own folder and put the script in there and run it for a while when you next FTP into your site you may see a strange file named "c9d44a39b2e1188cc4dbd683e0b866e5" or something equally strange. Thats nothing to worry about its just the cache copy of the RSS feed.
The script will cache the RSS from the other site so that your page will load faster on the majority of the page loads, and also the webmasters you will pull the RSS feed from will appreciate you taking some of the load of their servers.
@travelagent - you better get this to work Skip - I wrote this article especially for you. If I don't see an RSS feed on your site it will be a total failure - ha ha ha
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
Member
From: Pell City, Alabama USA
Registered: 2004-11-17
Posts: 2084
I've been thanked 5 times.
Offline
wer wrote:
Thanks for the script, it worked out pretty easily.
...
How do I get all the feeds from the array?
wer, if you want multiple feeds from different sites, then look at example #3 the advanced reader.
I didn't have space to write about its use in the article, but example #4 is the source code for the page that uses it.
Basically, what you'll do is get the Advanced Reader ( example #3) upload it to your server just as you did with the simple reader.
Then do this to get started
Code:
<?php
include("Reader.php");
$myRSS = new rssReader();
?>
Then everywhere you want a feed to appear, you do this
Code:
<?php
$myRSS->createHtmlFromFeed(0,10);
?>
The first number "0" specifys which one of the feeds you want to use and the second number "10" specifys how many entries from that feed to display. That way you can get all the entries, or just 2 or 3 depending on what will fit in your layout.
OR
The Advanced Reader will also let you do this:
Code:
<?php
$myRSS->createHtmlFromRSSUrl("http://www.somesite.com/rss.xml",10);
?>
TombOfTheMutilated.NET - Destroying The Minds of America's Youth Since 2001
I've tried everything suggested here and it still doesn't work. I don't get an error, it just displays the code and not the feed. I'm using other PHP code on the site that works fine....this doesn't.
Can you provide us with a link over to the page?
Today's article: A Unique Look at Adwords Advertising
In folder: CHMOD 775
http://www.all-about-planters.com/RSS/SimpleReader.php
Not: CHMOD 775
http://www.all-about-planters.com/SimpleReader.php
I just put your sample feeds back in, in case it was the feed I was trying and still doesn't work.
Thanks
Scarlett,
I don't know if this will do it (kind of a shot in the dark), but your script starts out this way:
<? php
Try chaging that to
<?php
(in other words, remove the space between the ? and php)
Today's article: A Unique Look at Adwords Advertising
Mutilated1 wrote:
wer, if you want multiple feeds from different sites, then look at example #3 the advanced reader.
I didn't have space to write about its use in the article, but example #4 is the source code for the page that uses it.
Basically, what you'll do is get the Advanced Reader ( example #3) upload it to your server just as you did with the simple reader.
Thanks again, very very cool of you to share this with us, worked great
well 1 little problem in reader.php
// Well do up the top 3 entries from the feed
for ($counter = 3; $counter <= $howmany; $counter++ )
the 3 needs to be set at 1 or it starts getting feed at item #3 ????
Not sure why, but when I changed it to a 1 it worked perfectly
Thanks again
and this couldn't have been any easier, nice work
Thanks Mutilated - easy one for me so far.
Although, my first problem was expecting to see the RSS feed in an HTML page. Idiot, idiot, idiot. Changed the page to a php page and no problem.
Used a blog feed from my site: Sail Search Blog to be displayed on this page: Sail Search Home
Next step is to multiple feeds.
I have noticed that on one of my other sites, where I am using an Amazon RSS feed for books, which stays pretty static I do rank extremely well for one particular book, so I am inclined to conclude that I am NOT being penalised for that RSS News feed.
Also a few of my RSS news feeds are published on a sailing news aggregator and my Google alerts regularly show my sites content in that one, so, again I do not think that the aggregator is being ''punished'' by the Search Engines.
Thought I would point out that M1's article has just been 'Digged'. Awesome job Mutilated!
Easy RSS Integration
Today's article: A Unique Look at Adwords Advertising
I had actually added the space, trying to make it work..no space version online now. Still doesn't work.
Administrator
From: you know you want a caricature
Registered: 2004-11-08
Posts: 3339
I've been thanked 31 times.
Offline
sounds like the title of the article may need to be ammended from
Quick and Easy Site Content with RSS and PHP
to
Fairly Quick and Almost Easy Site Content with RSS and PHP
Get an amazing caricature
Support OBAMA? Get a Tshirt
Get an avatar or mascot for your blog, Facebook or forum use
| Never |


