[英]php subscribing to rss feed
I'm trying to add rss feeds to my website. 我正在尝试将rss feed添加到我的网站。 There is a different rss feed for different topics.
针对不同主题有不同的RSS订阅源。 What i don't know how to do is allow the user to subscribe to an rss feed?
我不知道该怎么做才允许用户订阅RSS订阅源? I want to put a link that says 'subscribe to rss feed' or just the rss icon.
我想添加一个“订阅RSS订阅源”或只是rss图标的链接。
Feed.php
has the rss feeds, so depending on the $id
a different rss feed will be displayed. Feed.php
有rss feed,因此根据$id
将显示不同的RSS feed。
Feed.php Feed.php
<?php
header("Content-Type: application/xml; charset=ISO-8859-1");
include "database.php";
$id = $_GET['id'];
$type = $_GET['type'];
$position = $_GET['position'];
$database = new Database();
$database->opendb();
$items = $database->rssfeed($id,$position,$type);
$database->closedb();
?>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<?php
echo $items;
?>
</channel>
</rss>
What way do i allow the user to subscribe to an rss feed? 我允许用户以什么方式订阅RSS订阅源? For example a feed url on my website for a topic may be
www.example.com/feed/12
例如,我的网站上有关主题的Feed网址可能是
www.example.com/feed/12
Try the application/rss+xml mime type. 尝试应用程序/ rss + xml mime类型。 Browsers and plugins automatic detect your feed, and enabled the subscribe.
浏览器和插件会自动检测您的Feed,并启用订阅。 Try it on google reader or som.
在谷歌阅读器或索姆上试试吧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.