I try to read my iTunes RSS. I can read title, even itunes:subtitle but I have problems with the tag image.
FEED:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://ift.tt/IR9se2" version="2.0">
<channel>
<title>title of the podcast</title>
<itunes:image href="http://ift.tt/1zPU8Zk"/>
</channel>
</rss>
PHP:
$xml=("http://ift.tt/1C92kIb");
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
$channel=$xmlDoc->getElementsByTagName('channel')->item(0);
$channel_title = $channel->getElementsByTagName('title')//normal tag
->item(0)->childNodes->item(0)->nodeValue;
$channel_image = $channel->getElementsByTagName('image') //problem
->item(0)->childNodes->item(0)->nodeValue;
echo $channel_title . '<br>';
echo $channel_image . '<br>';
No comments:
Post a Comment