Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title> SITENAME - rss feed</title>
- <link href="https://getbootstrap.com/docs/4.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
- </head>
- <body>
- <h1>SITENAME RSS Feed Reader</h1>
- <form action="" method="post">
- <p>Enter site's feed url<br/> <input type="text" name="feedUrl" value="https://en.wikipedia.org/w/api.php?hidebots=1&hidecategorization=1&hideWikibase=1&urlversion=1&days=7&limit=50&action=feedrecentchanges&feedformat=rss"/></p>
- <p><input type="submit" name="feed"/></p>
- </form>
- <?php
- if (isset($_POST['feed'])) {
- $link = $_POST['feedUrl'];
- $rss_feed = simplexml_load_file("$link");
- if(!empty($rss_feed)) {
- $i=0;
- foreach ($rss_feed->channel->item as $feed_item) {
- if($i>=10) break;
- ?>
- <div><a class="feed_title" href="<?php echo $feed_item->link; ?>"><?php echo $feed_item->title; ?></a></div>
- <div><?php echo implode(' ', array_slice(explode(' ', $feed_item->description), 0, 14)) . "..."; ?></div>
- <?php
- $i++;
- }}
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement