Get data from XML using PHP

Sunday, July 6, 2014

i have simple XML file, like this:



<item>
<title>This is the title</title>
<description>Duration : 8 min&lt;br&gt;Url : http://ift.tt/1oy5tKp src='http://ift.tt/1oy5vSk'&gt;&lt;br&gt;&lt;img src='http://ift.tt/1jbR2N5'&gt;&lt;br&gt;&amp;lt;div id=&amp;quot;xv-embed-8324890&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; (function() { var tn = document.createElement('script'); tn.type = 'text/javascript'; tn.async = true; tn.src = 'http://ift.tt/1jbR3AC'; var s = document.getElementById('xv-embed-8324890'); s.parentNode.insertBefore(tn, s); })(); &amp;lt;/script&amp;gt;&lt;br&gt; </description>
<link>http://ift.tt/1pRCuoH
<guid>video8324890</guid>
<pubdate></pubdate>
</item>


I am trying to get each data from it, my try for title looks like:



include 'rss.xml';

$movies = new SimpleXMLElement($xmlstr);

echo $movies->item[0]->title;


But its not really working (it display whole XML file not just title) can somebody help me to solve my problem?


Thanks guys







http://ift.tt/1oy5vSu