I am trying to load an RSS feed from betfair
But I keep getting an error when I use the WP Error object that it is timing out.
I have a backup source to load similar data from but it is not as complete. Therefore I want to be able to extend the time the feed is allowed to load e.g even up to 30 seconds if possible as I can then cache it for future use.
The exact code is
$rss = fetch_feed('http://rss.betfair.com/RSS.aspx?format=rss&sportID=7'); if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly RSSDebug("no error"); // Figure out how many total items there are, but limit it to 20. $maxitems = $rss->get_item_quantity(20); RSSDebug("get 20 items"); // Build an array of all the items, starting with element 0 (first element). $rss_items = $rss->get_items(0, $maxitems); $count = 0; $max = 10; else: RSSDebug("couldnt load feed!"); RSSDebug("Error is " . $rss->get_error_message()); endif;
Where RSSDebug just outputs a string to the HTML
The messages I get are:
couldnt load feed!
Error is WP HTTP Error: Operation timed out after 10000 milliseconds with 0 bytes received.
10 seconds seems to be too slow at times so I need longer and I am having to rely on another source which is not so good.
I thought there would have been some overloaded constructor method to use which I could pass in a timeout but I cannot find anything online.
Any help would be appreciated as I am debating just using a file_get_contents/my own xml parsing code - Thanks