• Which method is best for periodically scraping an RSS feed? using the fetch_rss function or using the inlineRSS plugin?

    Right now I have a demo site (sorry it’s on my Mac locally so no links) set up with the fetch_rss function on a page and it works(!). Is it fetching the rss each time someone clicks? Is there anyway to set it so it only grabs the RSS every 8 or 12 hours?

    here’s what the template says:
    <?php
    /*
    Template Name: rss-listing
    Description: A template for scraping an rss feed.
    */
    ?>
    <?php get_header(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    <p>some text</p>
    <?php require_once(ABSPATH . WPINC . '/rss-functions.php'); ?>
    <?php $rss = fetch_rss('some-uri'); ?>
    <ul class="rss-listing">
    <?php foreach ( $rss->items as $item ) : ?>
    <li><?php echo $item['image_link']; ?>
    <a href='<?php echo $item['link']; ?>
    title='<?php echo $item['title']; ?>'>
    <?php echo $item['title']; ?>
    </a>
    <?php echo $item['description']; ?>
    </li>
    <?php endforeach; ?>
    </ul>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '', '
    '); ?>
    </div>
    rss
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I’m not a coder, just an amateur, so if anyone can help that would be great. Specific detailed step-by-step instructions would be awesome!

Viewing 1 replies (of 1 total)
  • Thread Starter ciryaquen

    (@ciryaquen)

    Digging in the codex again lead me to this Magpie RSS page.

    Caching the parsed RSS means that the 2nd request is fast, and that including the rss_fetch call in your PHP page won’t destroy your performance, and force you to reply on an external cron job. And it happens transparently.

    It was absolute beginner’s luck that the previously posted template works. The Magpie documentation goes right over my head. But, it looks like it is caching the RSS feed and not grabbing it each time. If anyone knows how to set the parameters for refreshing the rss please let me know. Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Best way to grab and display an RSS feed every once in a while’ is closed to new replies.