0

First question posted so sorry in advance if this has already been covered and I just couldn't find the answer.

I'm using SimplePie 1.2.1 to display an Atom feed of a client's Facebook wall on their corporate web page. It seems to work pretty well except that the latest entry SimplePie displays is from nearly a month ago.

When I test the feed URL in a browser, everything is up-to-date so there doesn't seem to be any problem with the feed.

Can anyone verify that the code below should indeed display the 3 latest posts? Am I overlooking something obvious?

In the Head:

// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('inc/simplepie.inc');

// We'll process this feed with all of the default options.
$feed = new SimplePie();

// Set the feed to process.
$feed->set_feed_url('http://www.facebook.com/feeds/page.php?format=atom10&id=160652600629357');

// Run SimplePie.
$feed->init();

$feed->handle_content_type();

In the body:

<?php
foreach ($feed->get_items(0,3) as $item):
?>

    <div class="item">
        <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
        <p><?php echo $item->get_description(); ?></p>
        <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
    </div>

<?php endforeach; ?>
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
be OH be
  • 33
  • 4
  • Well, what debug output does `var_dump($feed->get_items(0,3));` give you …? – CBroe Jul 17 '12 at 20:50
  • Somehow my original problem corrected itself. When I looked at the feed the next day, it was displaying the latest post. yay! However, I noticed that apostrophes aren't displaying correctly. Instead, SimplePie is outputting the ascii code ' Notice the second post on this page: http://ohn.zoarhosting.com/index-test.php. – be OH be Jul 25 '12 at 17:12
  • Oh, I also updated to SimplePie 1.3. – be OH be Jul 25 '12 at 17:22

1 Answers1

0

You're currently using 1.2.1 which is outdated, and additionally has known bugs which this may be affecting. Try using SimplePie 1.3 instead.

Ryan McCue
  • 1,628
  • 14
  • 23