RSS scripting

From: Date: Sun, 02 Jul 2000 21:49:25 +0000
Subject: RSS scripting
Groups: php.general 
Request: Send a blank email to php-general+get-4398@lists.php.net to get a copy of this message
I wanted to automate the creation of RSS info so that when the bots from my.userland.com and my.netscape.com came crawling it would dish up the latest articles from our site. Seeing as I'm on a shared NT server and don't have any access to cron or anything like that, I thought the script would just toss out the xml rdf format and the results from the database. Though I copied all the info it needs as per the spec, both rss parsers toss it back. Anyone else doing this? Any ideas? Here's the script: <?php echo "<?xml version="1.0" encoding="UTF-8"?>"\n; echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\" \"http://my.netscape.com/publish/formats/rss-0.91.dtd">\"\n; echo "<rss version=\"0.91\">"\n; echo "<channel>"\n; echo "<title>Digital Hit Entertainment</title>"\n; echo "<link>http://www.digitalhit.com</link>"\n; echo "<description>Entertainment and Celebrity News</description>"\n; echo "<language>en-us</language>"\n; echo "<rating>(PICS-1.1\"http://www.rsac.org/ratingsv01.html\" l gen true comment \"RSACi North America Server\" for \"http://www.rsac.org\" on \"1997.09.26T19:02-0800\" r (n 1 s 0 v 0 l 0))</rating>"\n; echo "<image>"\n; echo "<title>Digital Hit Entertainment</title>"\n; echo "<url>http://www.digitalhit.com/mndhe.gif</url>"\n; echo "<link>http://www.digitalhit.com</link>"\n; echo "<width>144</width>"\n; echo "<height>20</height>"\n; echo "</image>"\n; $topnews=0; $connect = odbc_connect("bla", "bla", "bla"); $query = "SELECT article_id, headline, date FROM news ORDER BY date DESC'\n; $result = odbc_exec($connect, $query); while (odbc_fetch_row($result)) { $topheadline = odbc_result($result, headline); $id = odbc_result($result, article_id); echo "<item>"\n; echo "<title>$topheadline</title>"\n; echo "<link>http://216.122.15.134/news/story.shtml/$id</link>"\n; echo "</item>"\n; $topnews++; if ($topnews > 4) { odbc_close($connect); break; } odbc_close($connect); echo "</channel>"\n; echo "</rss>"\n; ?> -- Ian Evans

« previous php.general (#4398) next »