Ajax software
Free javascripts
↑
Main Page
7.
Load
http://seophp.example.com/read_feed.php
, and you should get the results shown
in Figure 7-5.
Figure 7-5
So far, so good! Using
SimplePie
, it was almost too easy to read data from an external feed.
Again, you meet the advantages that OOP brings. The whole SimplePie library is based on a class
named SimplePie: all you have to do is to create an object of this class, and then start using the
appropriate methods:
<?php
// load the SimplePie library
require_once ‘include/simplepie.inc’;
// create and configure SimplePie object
$feed = new SimplePie();
$feed->feed_url(‘http://seophp.example.com/feed.php’);
$feed->cache_location(‘cache’);
$feed->init();
$feed->handle_content_type();
?>
For a detailed reference, please consult the SimplePie documentation at
http://simplepie.org/
docs/installation/getting-started/
.
163
Chapter 7: Web Feeds and Social Bookmarking
c07.qxd:c07 10:42 163
Ajax software
Free javascripts
→