I m trying to share my web site contents for other web sites using by external loop file or rss file.
when i asked some questions about wp_remote_get
function ; @Serkan suggest to me , using fecth_feed
methot / function etc. (check the question here.)=
I really confused , which one i should, which one is better way for high performance, could anyone explain it why ?
Thanks.
1 Answer
Neither are high performance, and they do different things.
fetch_feed
is for grabbing feeds RSS feeds etc, wp_remote_get
is for grabbing arbitrary items.
Neither are fast, and the performance difference between each is negligible or irrelevant, but technically fetch_feed
is slower than wp_remote_get
, not because it’s faster or slower at grabbing over the network, but because it uses SimplePie to parse the feed ( which you’d end up using anyway if you used wp_remote_get
on a feed ).
So even using wp_remote_get
, you’d get the Feed in the same amount of time, but then you’d have to write the code to process it afterwards, and I’m sure the SimplePie people will be faster as they’ve had more time to optimise and test than you.
So if you’re grabbing an RSS or Atom feed, use fetch_feed
If you’re grabbing html files, images, or other files, use wp_remote_get
Why don’t you use one of the feed aggregation plugins instead of reinventing the wheel?