Created
February 4, 2016 08:42
-
-
Save rotten77/14be7867eded71cb33ff to your computer and use it in GitHub Desktop.
Blogger.com RSS feed reader
This file contains 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 | |
$feed = file_get_contents('http://www.adsr.cz/feeds/posts/default'); | |
$xml = simplexml_load_string($feed); | |
$items = array(); | |
foreach($xml->entry as $entry) { | |
$url = null; | |
foreach($entry->link as $itemLink) { | |
$attributes = $itemLink->attributes(); | |
if($attributes['rel']=="alternate") $url = (string)$attributes['href']; | |
} | |
$items[] = array( | |
'title' => (string)$entry->title, | |
'content' => trim(strip_tags((string)$entry->content)), | |
'published' => date("Y-m-d H:i:s", strtotime($entry->published)), | |
'url' => $url, | |
); | |
} | |
print_r($items); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment