title: php: displaying titles and images of rss feed using xPath
body: <p>I'm trying to get the titles and images of an rss feed to display using xpath in php. But it is only displaying 1 title. All the titles are not displaying and none of the images are getting displayed. My code:</p>
  
  <pre><code>function getImage($xml){
      $items=$xml-&gt;xPath('/rss/channel/item');
      foreach($items as $item){
          echo($item-&gt;title);
          $encl=$xml-&gt;xPath('//enclosure');
          print_r('&lt;img src='.$encl-&gt;attributes()-&gt;url.'/&gt;');
          echo('&lt;br&gt;');
      }
  </code></pre>
  
  <p>Can someone point out on where i'm going wrong? Thank you.</p>