在PHP中为任何网站创建RSS(类似于Feedity或Feed43)


Creating RSS for any website in PHP (Similar to Feedity or Feed43)


对于我的项目,我想构建一个PHP脚本,它可以为任何网站创建RSS,就像Feedity或Feed43一样。
任何关于从哪里开始以及如何帮助将不胜感激...

要制作RSS,您只需要打印正确的格式。首先,您需要制作标头:

<?php header('Content-Type: application/rss+xml; charset=UTF-8'); ?>
<?xml version="1.0" encoding="UTF-8" ?>
    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Example RSS</title>
        <link>http://the.link.to.this.page</link>
        <description>A description of this RSS channel.</description>
        <atom:link href="http://the.link.to.this.page" rel="self" type="application/rss+xml" />

现在,您吐出以下项目:

<item>
    <title>A title of the item</title>
    <guid>A Unique ID</guid>
    <description>The main text for the item.</description>
</item>

你显然会使用 PHP 来自定义一组要吐出的项目。您可以使用以下命令正确关闭所有内容:

    </channel>
</rss>