server-webapi-code-04-feedSideCaching.php / php
<?php header("Content-Type: text/xml"); include("./feedcache.php"); if (cacheIsRecent()) { echo getCache(); }else { ob_start(); ?><rss version="2.0"> <channel> <language>en</language> <title>Easy Recipes</title> <description>Easy recipes for the computer hacker/culinary slacker.</description> <link>example.preinheimer.com/feed1.php<image> <title>Easy Recipes</title> <link>example.preinheimer.com/feed1.php<url>example.preinheimer.com/feed1.png</image><?php include("./common_db.php"); recipies = getAssoc(recipies AS <item>\n"; echo "<title>{item['title']}</title>\n"; echo "<link>{</link>\n"; echo "<description>{item['description']}</description>\n"; echo "<author>{</author>\n"; echo "<category>{item['category']}</category>\n"; echo "<pubdate>{</pubdate>\n"; echo "</item>\n"; } echo "</channel>\n</rss>"; updateCache(ob_get_contents()); ob_end_flush(); } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.