title: PHP: Youtube latest video feed php code mechanism
body: <p>I am currently adapted a code to my website's use but now I would like to change some of its format but it has been a harder task than expected. My code right now is displaying the latest video. But my goal at the moment is to have the code display the videos *thumbnail pic, *video description and *total views. Below is my code, If you think there is a better way to approach this then I am open for suggestions:</p>
  
  <pre><code>&lt;? 
      error_reporting(E_ALL);
      $feedURL = 'http://gdata.youtube.com/feeds/api/users/USERNAME/uploads?max-results=20';
      $sxml = simplexml_load_file($feedURL);
      $i = 0;
      foreach ($sxml-&gt;entry as $entry) {
              $media = $entry-&gt;children('media', true);
              $url = (string)$media-&gt;group-&gt;player-&gt;attributes()-&gt;url;
              $index = strrpos($url, "&amp;");
              $url = substr($url, 0, $index);
              $index = strrpos($url, "watch");
              $url = substr($url, 0, $index) . "v/" . substr($url, $index + 8, strlen($url) - ($index + 8));
              echo '&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="src" value="' . $url . '" /&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;embed type="application/x-shockwave-flash" width="400" height="250" src="' . $url . '" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;';
              break;
      }
  </code></pre>
  
  <p>?></p>