-
-
Save CB9TOIIIA/763f2b4c96e2be430fd2543c765534ce to your computer and use it in GitHub Desktop.
Парсер rss ленты на php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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