SyP-

feed-reader.php

Jun 23rd, 2021 (edited)
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  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.  
  10. <h1> esta es una nueva version </h1>
  11. <h1>SITENAME RSS Feed Reader</h1>
  12. <form action="" method="post">
  13. <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>
  14. <p><input type="submit" name="feed"/></p>
  15. </form>
  16. <?php
  17. if (isset($_POST['feed'])) {
  18.     $link = $_POST['feedUrl'];
  19. $rss_feed = simplexml_load_file("$link");
  20. if(!empty($rss_feed)) {
  21. $i=0;
  22. foreach ($rss_feed->channel->item as $feed_item) {
  23. if($i>=10) break;
  24. ?>
  25. <div><a class="feed_title" href="<?php echo $feed_item->link; ?>"><?php echo $feed_item->title; ?></a></div>
  26. <div><?php echo implode(' ', array_slice(explode(' ', $feed_item->description), 0, 14)) . "..."; ?></div>
  27. <?php
  28. $i++;
  29. }}
  30. }
  31. ?>
  32.  </body>
Add Comment
Please, Sign In to add comment