i'm using fetch_rss() in one of my plugins and it works ok but not with feeds that take a little longer than normal to load.
is there any way to increase the timeout figure from the 5 seconds currently used to 10 seconds without installing magpie?
i'm using fetch_rss() in one of my plugins and it works ok but not with feeds that take a little longer than normal to load.
is there any way to increase the timeout figure from the 5 seconds currently used to 10 seconds without installing magpie?
Actually, it's a 2 second timeout.
Add this to your wp-config.php file:
define('MAGPIE_FETCH_TIME_OUT', 2);
Adjust the number as you see fit.
thanks Otto!
that worked a treat, now how would I implement that in the plugin so that a user of the plugin wouldn't have to actually edit their own config file?
Just put it in the plugin instead of wp-config.php. The plugins load before the rss functions do.
otto, thank you so much!
I was having a problem with feeds from one blog not showing up on another block (which I diagnosed as a rss_fetch error), that remained a mystery.
I've now upgraded WordPress from v2.2.1 to v2.3.2, and happened to find this thread. I suspect that my problem is a timeout error, and am experimenting. I've added define('MAGPIE_FETCH_TIME_OUT', 5); to wp-config.php .
I had written a branch, i.e. on http://daviding.com/blog , `<h2>Recently on coevolving.com</h2>
<?php require_once(ABSPATH . WPINC . '/rss.php'); ?>
<?php $rss = fetch_rss('http://coevolving.com/blogs/index.php/feed/'); ?>
<?php if (empty($rss->items)) echo "
else
foreach ( $rss->items as $item ) : ?>
title='<?php echo $item['title']; ?>'>
<?php echo $item['title']; ?>
<?php endforeach; ?>
... and now you can see the page load hang as it tries to access the other feed.
It's still a mystery to me! I had thought that Magpie does some caching, so I'll leave this change in place for a little while, to see if it shakes itself out.
I tried the define code (and triple-checked syntax) and I get an error that wp-blog-header.php has undefined functions (directly below the line where it imports wp-config.php). No matter whether I copy and paste from here or manually type in the line of code, it simply won't work.
Looking at the code again, I've noticed that ...
... reads on the codex as ...<?php require_once(ABSPATH . WPINC . '/rss.php'); ?>
<?php include_once(ABSPATH . WPINC . '/rss.php'); ?>
I'm not a real WordPress expert, so I'm not sure what the difference between the require_once and include_once is ... but it seems to have solved my problem -- at least in one direction of feeding the blog to the other.
This topic has been closed to new replies.