Page 1 of 1

RSS Feed

Posted: Tue May 13, 2008 1:43 pm
by fawcettj
I'm a little new to RSS aggregation. I'm trying to build a feed reader for my districts site, so we can just have a little tighter implementation of the calendar. I've been using the magpieRSS class for RSS parsing.

I guess my question is, has anyone gotten magpie to work with the calendar feed? I get a request timed out error every time I try and fetch the RSS object.
Warning: MagpieRSS: Failed to fetch http://roysecityisdtxus.intand.com/inde ... action=rss (Request timed out after 5 seconds) in C:\apache\htdocs\rss_fetch.inc on line 238


I'd also like to note that my districts calendar feed does not validate.
http://feedvalidator.org/check.cgi?url=http%3A%2F%2Froysecityisdtxus.intand.com%2Findex.php%3Ftype%3Dexport%26action%3Drss

Perhaps this is one of the reasons why I'm getting the error. Then again, I really don't know what I'm doing!

Re: RSS Feed

Posted: Wed May 14, 2008 3:05 pm
by Andrew (Tandem)
Thanks for letting us know about this. We fixed the issue where the RSS feed would not validate. We also installed and tested MagpieRSS (v 0.72) and we got it to work after the changes. Let us know if you have any further difficulties.

Re: RSS Feed

Posted: Thu May 15, 2008 11:31 am
by fawcettj
Yeah.. I'm still getting timeout errors. I'm also using MagpieRSS v0.72

Here's my code if it helps.. just a simple fetch

Code: Select all

require_once 'rss_fetch.inc';
$url = 'http://roysecityisdtxus.intand.com/index.php?type=export&action=rss';
   $rss = fetch_rss( $url );
   echo "Channel: " . $rss->channel['title'] . "<p>";
   echo "<ul>";
   foreach ($rss->items as $item) {
      $href = $item['link'];
      $title = $item['title'];   
      echo "<li><a href=$href>$title</a></li>";
   }
   echo "</ul>";


Unfortunately, it never actually fetches the RSS due to the 5 second timeout. I can change the url to another feed and it works just fine.

You said you installed MagpieRSS. I hadn't done much research on RSS parsing, so I just got the seemingly most popular one. Is there a better class I could be using?

Re: RSS Feed

Posted: Thu May 15, 2008 2:45 pm
by Scott (Tandem)
Hmm... that is very odd indeed. I copied all the code you posted and it ran fine on my local computer. I think the whole 5 second timeout thing might be tripping you up - try and extend that to aleast 30 seconds (you will probably have to either modify your Apache settings or your PHP settings).

Can you get to http://roysecityisdtxus.intand.com/index.php?type=export&action=rss from your web browser (Internet Explorer, Firefox, etc...)? If you can, try seeing how long that takes to load - maybe there is something funky going on with your internet connection.

As for a class to use for RSS parsing - I actually haven't done any research on it myself - but it looks like MagpieRSS should be fine. I know there are some imbedded functions and classes in PHP you can use - but it looks like MagpieRSS makes all that simpler.

Anyway, hopefully that helps.

Re: RSS Feed

Posted: Mon May 19, 2008 7:44 am
by fawcettj
First off, thanks for helping out guys.

The timeout is actually an error function in the MagpieRSS fetch file. Even when I gave it more time, it still didn't work.

I'm sure now that the problem is on my end. The RSS feed that I got to work successfully was local. Turns out, that's the only feed I've successfully aggregated.

It's weird. I can view feeds just fine in Firefox, but I can't fetch them via php. Any ideas?

Re: RSS Feed

Posted: Mon May 19, 2008 6:02 pm
by Scott (Tandem)
Try adding the following code right before you call require 'rss_fetch.inc':

Code: Select all

define('MAGPIE_FETCH_TIME_OUT', 30);


for example:

Code: Select all

define('MAGPIE_FETCH_TIME_OUT', 30);
require_once 'rss_fetch.inc';
$url = 'http://roysecityisdtxus.intand.com/index.php?type=export&action=rss';
   $rss = fetch_rss( $url );
   echo "Channel: " . $rss->channel['title'] . "<p>";
   echo "<ul>";
   foreach ($rss->items as $item) {
      $href = $item['link'];
      $title = $item['title'];   
      echo "<li><a href=$href>$title</a></li>";
   }
   echo "</ul>";


Also - if you have a firewall (you probably do if you have Windows XP SP2 or later) - there is a possibility that it might be blocking your PHP script from accessing the internet.

Let us know what you find.

Re: RSS Feed

Posted: Fri May 23, 2008 10:07 am
by fawcettj
I figured out the problem...

Apparently our server was confused as to which gateway it needs to use... Once I cleared all that up, everything started working.. thanks for all the help getting the feed to validate and what-not!

Re: RSS Feed

Posted: Fri May 23, 2008 10:20 am
by Scott (Tandem)
No problem! We are glad to help.

Let us know when you get everything up and working - we'd love to see it in action.

Re: RSS Feed

Posted: Thu Jun 12, 2008 6:59 am
by fawcettj
Here's a link to the Feed in action.
http://www.rcisd.org/new/hs/
The page is obviously still in the early stages. I'll have some options that the user will be able to select to sort of narrow what results that particular user gets. Just the general high school stuff broken up by activity (athletics, band, etc..)

thanks again for the help.

Re: RSS Feed

Posted: Tue Sep 09, 2008 4:14 pm
by Andrew (Tandem)
Check out the topic "RSS Feeds and XML Feeds under the microscope" for more information on RSS feeds and how we use them in Tandem.