-
-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathexample-rss.php
More file actions
27 lines (19 loc) · 790 Bytes
/
example-rss.php
File metadata and controls
27 lines (19 loc) · 790 Bytes
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
<?php
header('Content-Type: text/html; charset=utf-8');
if (!ini_get('date.timezone')) {
date_default_timezone_set('Europe/Prague');
}
require_once 'src/Feed.php';
$rss = Feed::loadRss('https://phpfashion.com/feed/rss');
?>
<h1><?php echo htmlspecialchars($rss->title) ?></h1>
<p><i><?php echo htmlspecialchars($rss->description) ?></i></p>
<?php foreach ($rss->item as $item): ?>
<h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a>
<small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2>
<?php if (isset($item->{'content:encoded'})): ?>
<div><?php echo $item->{'content:encoded'} ?></div>
<?php else: ?>
<p><?php echo htmlspecialchars($item->description) ?></p>
<?php endif ?>
<?php endforeach ?>