Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'http://www.feedforall.com/sample.xml';
- $xml = @simplexml_load_file($url);
- $articles = array();
- if ($xml) {
- foreach ($xml->channel->item as $item) {
- $articles[] = sprintf(
- '<li><a href="%s">%s</a><br>%s</li>' . PHP_EOL,
- $item->link,
- $item->title,
- mb_strimwidth($item->description, 0, 120, '...', 'UTF-8')
- );
- }
- } else {
- $articles[] = '<li>εεΎε€±ζ</li>';
- }
- shuffle($articles);
- foreach ($articles as $article) {
- echo $article;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement