Skip to content

Instantly share code, notes, and snippets.

@CB9TOIIIA
Forked from bizikov/rss-parser.php
Created November 14, 2016 08:39
Show Gist options
  • Save CB9TOIIIA/763f2b4c96e2be430fd2543c765534ce to your computer and use it in GitHub Desktop.
Save CB9TOIIIA/763f2b4c96e2be430fd2543c765534ce to your computer and use it in GitHub Desktop.
Парсер rss ленты на php
<?php
$orenru = 'http://www.oren.ru/rss/';
$ural56 = 'http://www.ural56.ru/news/news-rss.php';
$oreninform = 'http://oreninform.ru/rss/';
$ru56 = 'http://56.ru/text/rss.xml';
$xml = $orenru;
$rss = simplexml_load_file($xml);
echo '<div class="orenburg-rss-stream"><ul>';
foreach ($rss->channel->item as $item) {
$title = mb_substr($item->title,0,100,'UTF-8');
$link = $item->link;
$date = substr($item->pubDate,4,13);
$img = $item->enclosure->attributes()->url;
echo '<li>
<div class="ithem">
<p class="title"><a target="blank" href="' .$link. '">' .$title. '</a></p>
</div>';
echo '<img src="' .$img. '" /></li>';
}
echo '</ul></div>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment