imported>mutante mNo edit summary |
imported>mutante m (Magpie moved to MagpieRSS) |
||
(One intermediate revision by the same user not shown) | |||
Line 20: | Line 20: | ||
Done. |
Done. |
||
<pre> |
|||
NAME |
|||
MagpieRSS - a simple RSS integration tool |
|||
SYNOPSIS |
|||
require_once(rss_fetch.inc); |
|||
$url = $_GET['url']; |
|||
$rss = fetch_rss( $url ); |
|||
echo "Channel Title: " . $rss->channel['title'] . "<p>"; |
|||
echo "<ul>"; |
|||
foreach ($rss->items as $item) { |
|||
$href = $item['link']; |
|||
$title = $item['title']; |
|||
echo "<li><a href=$href>$title</a></li>"; |
|||
} |
|||
echo "</ul>"; |
|||
</pre> |
|||
* http://magpierss.sourceforge.net/ (download) |
* http://magpierss.sourceforge.net/ (download) |
||
Line 25: | Line 47: | ||
* http://laughingmeme.org/magpie_blog/?p=80 (how to install) |
* http://laughingmeme.org/magpie_blog/?p=80 (how to install) |
||
Related: [[MediawikiExtensions/RSS]] [[RssNewsfeeds]] [[RecentChangesOfOurNeighbors]] |
|||
[[Category:PHP]] |
[[Category:PHP]] |
||
[[Category:Computer]] |
[[Category:Computer]] |
Latest revision as of 06:20, 7 April 2006
A PHP class for parsing RSS newsfeeds (and 'atom' feeds)
MagpieRSS provides an XML-based (expat) RSS parser in PHP.
MagpieRSS is compatible with RSS 0.9 through RSS 1.0. Also parses RSS 1.0's modules, RSS 2.0, and Atom. (with a few exceptions)
MagpieRSS requires a recent PHP 4+ (developed with 4.2.0) with XML (expat) support.
Magpie consists of 4 files (rssfetch.inc, rssparser.inc, rsscache.inc, and rssutils.inc), and the directory extlib (which contains a modified version of the Snoopy HTTP client)
Copy these 5 resources to a directory named ‘magpierss’ in the same directory as your PHP script.
At the top of your script add the following line:
require_once('magpierss/rss_fetch.inc');
Now you can use the fetch_rss() method:
$rss = fetch_rss($url);
Done.
NAME MagpieRSS - a simple RSS integration tool SYNOPSIS require_once(rss_fetch.inc); $url = $_GET['url']; $rss = fetch_rss( $url ); echo "Channel Title: " . $rss->channel['title'] . "<p>"; echo "<ul>"; foreach ($rss->items as $item) { $href = $item['link']; $title = $item['title']; echo "<li><a href=$href>$title</a></li>"; } echo "</ul>";
- http://magpierss.sourceforge.net/ (download)
- http://laughingmeme.org/magpie_blog/?p=80 (how to install)
Related: MediawikiExtensions/RSS RssNewsfeeds RecentChangesOfOurNeighbors