You are here:  » RSS Feed Provider Site is Down


RSS Feed Provider Site is Down

Submitted by g3org3s on Mon, 2007-05-21 16:22 in

Hello Dave

I hope your move is going well. I have referred to the support forum quite a bit and must say you are a a very patient and helpful person. Thank you. I can't find anything in the forum about when the rss provider's site is down. We use feeds from the Telegraph but today their site is down and consequently our pages won't load. Is there a bit that can be inserted into the code to check whether the rss is available prior to trying to display it?

".MagicParser_getErrorMessage()."";
exit;
}
print "Motoring News";
function myRecordHandler($record) {
global $counter;

print "" . $record["TITLE"] . "" . $record["DESCRIPTION"] . "read on..." . "";
$counter++;
return ($counter == 8);
}
MagicParser_parse($filename,"myRecordHandler",$format);
?>

Submitted by support on Thu, 2007-05-24 12:09

Hi,

What you're able to do I guess depends on the failure mode of the source RSS feed. As you say that your pages won't load, it implies that fopen() - which is used by MagicParser.php to open the connection - is waiting for a network timeout which is probably set to quite a high value on your installation. The timeout can, however, be set via the ini_set() function, so you could try adding the following to the top of your script:

  ini_set('default_socket_timeout', 3);

(adjust the value for more or less than 3 seconds)

This should prevent your pages from taking too long to load...

Hope this helps,
Cheers,
David.

Submitted by g3org3s on Fri, 2007-05-25 14:57

Thank you, I will add this to the script.

The Telegraph issue has got weirder though. The Telegraph site is back up and another site that uses the feed appears to be operating and displaying the feed ok but not mine.

It now says could not open where the feed should display.
Other pages on the site that use different feeds are working ok and the telegraph feed runs through your demo ok.

I thought the telegraph may have blocked our ip so I tested it on some other sites I manage with different ips and it still didn't work. I don't suppose you'd have a solution for this as it just seems too weird.

Submitted by support on Sat, 2007-05-26 15:14

Hi there,

It may be that the Telegraph server is not accepting connections from the PHP user-agent, which is how PHP identifies itself when accessing a URL from fopen(). It is possible to change this in the same way as the socket timeout, so you could try adding the following code:

  ini_set('user_agent', 'My Agent/1.0');

Looking at other options, it might be that 3 seconds is too short for the Telegraph feed and that you need to use a higher value, so that is something else to look at trying...

Cheers,
David.