-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrss.php
41 lines (30 loc) · 1.28 KB
/
rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once(dirname(__FILE__). '/inc/common.php');
$conditions = array("frequency" => "once");
$seeds = get_seeds($conditions, 100);
$channel = array(
"title" => "Digital Archive of the Japan 2011 Earthquake and Aftermath",
"description" => "This rss feed contains the 100 most recent links added to the collection for archiving once.",
"link" => "http://www.jdarchive.org/rss.php"
);
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= "\n";
$output .= '<rss version="2.0">';
$output .= "\n<channel>";
$output .= "\n <title>" . $channel["title"] . "</title>";
$output .= "\n <description>" . $channel["description"] . "</description>";
$output .= "\n <link>" . $channel["link"] . "</link>\n";
foreach ($seeds as $seed) {
$output .= " <item>\n";
$output .= " <title>" . $seed->title . "</title>\n";
$output .= " <description>" . $seed->description . "</description>\n";
$output .= " <category>" . $seed->category . "</category>\n";
$output .= " <link>" . htmlentities($seed->url) . "</link>\n";
$output .= " <pubDate>" . date("D, d M Y H:i:s O", strtotime($seed->added)) . "</pubDate>\n";
$output .= " </item>\n";
}
$output .= "</channel>\n";
$output .= "</rss>";
header("Content-Type: application/rss+xml; charset=utf-8");
echo $output;
?>