I have a php code that use to parse xml data, but it is not working, my php code look as following:
<?php
$xml = '<?xml version="1.0" encoding="utf-8"?>
<videos>
<video>
<id>751985</id>
<embed><![CDATA[somehtmlcode]]></embed>
<thumbs>
<thumb><![CDATA[http://example.com/images/thum01.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum02.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum03.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum04.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum05.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum06.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum07.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum08.jpg></thumb>
</thumbs>
<link><![CDATA[http://example.com/001]]></link>
<title><![CDATA[Some cool title 1]]></title>
<categories>
<category><![CDATA[Cat1]]></category>
<category><![CDATA[Cat2]]></category>
<category><![CDATA[Cat3]]></category>
<category><![CDATA[Cat4]]></category>
</categories>
<tags>
<tag><![CDATA[tag1]></tag>
<tag><![CDATA[tag2]></tag>
<tag><![CDATA[tag3]></tag>
</tags>
<someone>
</someone>
<duration><![CDATA[8:17]]></duration>
<pubDate><![CDATA[2014-05-14]]></pubDate>
</video>
<video>
<id>751988</id>
<embed><![CDATA[somehtmlcode]]></embed>
<thumbs>
<thumb><![CDATA[http://example.com/images/thum01.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum02.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum03.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum04.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum05.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum06.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum07.jpg></thumb>
<thumb><![CDATA[http://example.com/images/thum08.jpg></thumb>
</thumbs>
<link><![CDATA[http://example.com/001]]></link>
<title><![CDATA[Some cool title 1]]></title>
<categories>
<category><![CDATA[Cat1]]></category>
<category><![CDATA[Cat2]]></category>
<category><![CDATA[Cat3]]></category>
<category><![CDATA[Cat4]]></category>
</categories>
<tags>
<tag><![CDATA[tag1]></tag>
<tag><![CDATA[tag2]></tag>
<tag><![CDATA[tag3]></tag>
</tags>
<someone>
</someone>
<duration><![CDATA[8:17]]></duration>
<pubDate><![CDATA[2014-05-14]]></pubDate>
</video>
</videos>';
$sxe = simplexml_load_string($xml);
foreach ($sxe->video as $videoChild) {
echo $videoChild->id;
echo $videoChild->title;
}
?>
it does not get the value of node, i need to get id, embed, thumb, link, title, without the CDATA tag. any help would be great.