I want to get media:thumbnail url from this RSS. It's a wordpress blog:
http://blog.khayyamkar.ir/category/news/feed/
I did some research and found this solution:
https://www.sitepoint.com/parsing-xml-with-simplexml/
But thumbnail attribute is always NULL! and I cannot find the problem
UPDATE: -> 'group' was a miss understanding.
the new code is this. But it's a "object(SimpleXMLElement)[33]" and I don't know how to extract Url:
$item->children($namespace['media'])
This is my code:
$url = $this->config->config['wp_news_feed'];
$xml = simplexml_load_file($url, null, LIBXML_NOCDATA);
$namespace = $xml->getNamespaces(true);
foreach ($xml->channel->item as $item)
{
// $group = $item->children($namespace['media'])->group;
$group = $item->children($namespace['media']);
var_dump($group->thumbnail);// <------ This is object(SimpleXMLElement)[32]
}