Blame | Last modification | View Log | RSS feed
REQUIREMENTSMapieRSS requires a recent PHP 4+ (developed with 4.2.0)with xml (expat) support.Optionally:* PHP5 with libxml2 support.* cURL for SSL support* iconv (preferred) or mb_string for expanded character set supportQUICK STARTMagpie consists of 4 files (rss_fetch.inc, rss_parser.inc, rss_cache.inc,and rss_utils.inc), and the directory extlib (which contains a modifiedversion of the Snoopy HTTP client)Copy these 5 resources to a directory named 'magpierss' in the samedirectory 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. That's it. See README for more details on using MagpieRSS.NEXT STEPSImportant: you'll probably want to get the cache directory working inorder to speed up your application, and not abuse the webserver you'redownloading the RSS from.Optionally you can install MagpieRSS in your PHP include path in order tomake it available server wide.Lastly you might want to look through the constants in rss_fetch.inc see ifthere is anything you want to override (the defaults are pretty good)For more info, or if you have trouble, see TROUBLESHOOTINGSETTING UP CACHINGMagpie has built-in transparent caching. With caching Magpie will onlyfetch and parse RSS feeds when there is new content. Without this featureyour pages will be slow, and the sites serving the RSS feed will be annoyedwith you.** Simple and Automatic **By default Magpie will try to create a cache directory named 'cache' in thesame directory as your PHP script.** Creating a Local Cache Directory **Often this will fail, because your webserver doesn't have sufficientpermissions to create the directory.Exact instructions for how to do this will vary from install to install andplatform to platform. The steps are:1. Make a directory named 'cache'2. Give the web server write access to that directory.An example of how to do this on Debian would be:1. mkdir /path/to/script/cache2. chgrp www-data /path/to/script/cache3. chmod 775 /path/to/script/cacheOn other Unixes you'll need to change 'www-data' to what ever user Apacheruns as. (on MacOS X the user would be 'www')** Cache in /tmp **Sometimes you won't be able to create a local cache directory. Some reasonsmight be:1. No shell account2. Insufficient permissions to change ownership of a directory3. Webserver runs as 'nobody'In these situations using a cache directory in /tmp can often be a goodoption.The drawback is /tmp is public, so anyone on the box can read the cachefiles. Usually RSS feeds are public information, so you'll have to decidehow much of an issue that is.To use /tmp as your cache directory you need to add the following line toyour script:define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');** Global Cache **If you have several applications using Magpie, you can create a singleshared cache directory, either using the /tmp cache, or somewhere else onthe system.The upside is that you'll distribute fetching and parsing feeds acrossseveral applications.INSTALLING MAGPIE SERVER WIDERather then following the Quickstart instructions which requires you to havea copy of Magpie per application, alternately you can place it in someshared location.** Adding Magpie to Your Include Path **Copy the 5 resources (rss_fetch.inc, rss_parser.inc, rss_cache.inc,rss_utils.inc, and extlib) to a directory named 'magpierss' in your includepath. Now any PHP file on your system can use Magpie with:require_once('magpierss/rss_fetch.inc');Different installs have different include paths, and you'll have to figureout what your include_path is.From shell you can try:php -i | grep 'include_path'Alternatley you can create a phpinfo.php file with contains:<?php phpinfo(); ?>Debian's default is:/usr/share/php(though more idealogically pure location would be /usr/local/share/php)Apple's default include path is:/usr/lib/phpWhile the Entropy PHP build seems to use:/usr/local/php/lib/php