37 lines
1.1 KiB
PHP
Executable File
37 lines
1.1 KiB
PHP
Executable File
<?php
|
|
include_once("includes/config.php");
|
|
|
|
// PDO query
|
|
$postQuery = $con->prepare("SELECT * FROM posts ORDER BY id DESC");
|
|
$postQuery->execute();
|
|
|
|
header("Content-type: text/xml");
|
|
|
|
echo "<?xml version='1.0' encoding='UTF-8'?>
|
|
<rss version='2.0'>
|
|
<channel>
|
|
<title>Win's Posts RSS Feed</title>
|
|
<link>https://posts.winscloud.net/</link>
|
|
<description>Win's Posts - The homepage of Win's Life</description>
|
|
<language>en-us</language>";
|
|
|
|
while($result = $postQuery->fetch(PDO::FETCH_ASSOC)) {
|
|
|
|
$postUrl = $result["url"];
|
|
$postContent = $result["content"];
|
|
$postAuthor = $result["author"];
|
|
// $rawDate = $result["published"];
|
|
$postDate = date('M j Y g:i A', strtotime($result["published"]));
|
|
|
|
echo "<item>
|
|
<title>Post by $postAuthor</title>
|
|
<link>https://posts.winscloud.net/status?url=$postUrl</link>
|
|
<guid>https://posts.winscloud.net/status?url=$postUrl</guid>
|
|
<pubDate>$postDate</pubDate>
|
|
<description>$postContent</description>
|
|
</item>";
|
|
|
|
}
|
|
|
|
echo "</channel></rss>";
|
|
?>
|