SyP-

feed.php

Nov 16th, 2020
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SITENAME - rss feed</title>
  6. <link href="https://getbootstrap.com/docs/4.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
  7. </head>
  8. <body>
  9. <h1>SITENAME RSS Feed Reader</h1>
  10. <form action="" method="post">
  11. <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>
  12. <p><input type="submit" name="feed"/></p>
  13. </form>
  14. <?php
  15. if (isset($_POST['feed'])) {
  16. $link = $_POST['feedUrl'];
  17. $rss_feed = simplexml_load_file("$link");
  18. if(!empty($rss_feed)) {
  19. $i=0;
  20. foreach ($rss_feed->channel->item as $feed_item) {
  21. if($i>=10) break;
  22. ?>
  23. <div><a class="feed_title" href="<?php echo $feed_item->link; ?>"><?php echo $feed_item->title; ?></a></div>
  24. <div><?php echo implode(' ', array_slice(explode(' ', $feed_item->description), 0, 14)) . "..."; ?></div>
  25. <?php
  26. $i++;
  27. }}
  28. }
  29. ?>
  30. </body>
  31. </html>
RAW Paste Data