Re: RSS scripting
| From: | Steve Driver | Date: | Sun, 02 Jul 2000 22:04:17 +0000 |
| Subject: | Re: RSS scripting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4400@lists.php.net to get a copy of this message | ||
Maybe this from the FAQ will help?..
<snip>
5.10 How am I supposed to mix XML and PHP? It complains about my <?xml>
tags!
You need to turn off the short tags by setting short_tags to 0 in your
php3.ini file, or by using the php3_short_tags Apache directive. (You could
even use a <File> section to do this selectively.) You can also disable and
re-enable the short tags in your script using the short_tags() function.
</snip>
----- Original Message -----
From: "Digital Hit Entertainment" <ianevans@friedspamdigitalhit.com>
To: <php-general@lists.php.net>
Sent: Sunday, July 02, 2000 10:49 PM
Subject: [PHP] RSS scripting
> 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</urluå,
> 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>ÜêôeW“$w
> Úš`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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>