Advertisement
Different55

EE RSS

Nov 18th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. $feed = file_get_contents('http://blog.everybodyedits.com/feed/'); // Get feed from blog
  3. $rss = simplexml_load_string($feed); // PHPify it with black magic
  4.  
  5. $title = $rss->channel->item->title."<br />\n"; // Get the title
  6. $rawpost = $rss->channel->item->children('content', true)->encoded."\n"; // Get the whole post
  7. $comments = strrpos($rawpost, '<a rel="nofollow"'); // Find where the comments button begins. This works because it's the only nofollow link in the post.
  8. $post = substr($rawpost, 0, $comments); // Get the part of the post starting from the beginning until the start of the comments button.
  9.  
  10. echo $title."\n";
  11. echo $post."\n";
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement