I am parsing a rss feed to json using php.
using below code
my json output contains data out of description from item element but title and link data not extracting
- problem is some where with incorrent CDATA or my code is not parsing it correctly.
xml is here
$blog_url = 'http://www.blogdogarotinho.com/rssfeedgenerator.ashx';
$rawFeed = file_get_contents($blog_url);
$xml=simplexml_load_string($rawFeed,'SimpleXMLElement', LIBXML_NOCDATA);
// step 2: extract the channel metadata
$articles = array();
// step 3: extract the articles
foreach ($xml->channel->item as $item) {
$article = array();
$article['title'] = (string)trim($item->title);
$article['link'] = $item->link;
$article['pubDate'] = $item->pubDate;
$article['timestamp'] = strtotime($item->pubDate);
$article['description'] = (string)trim($item->description);
$article['isPermaLink'] = $item->guid['isPermaLink'];
$articles[$article['timestamp']] = $article;
}
echo json_encode($articles);
tag after <![CDATA[ in xml for title I was able to success fully parse.... but still that dows not solves the issue – Rajnish Mishra Jun 01 '14 at 18:06