title: Getting Youtube videos using json and php
body: <p>I'm trying to get a video url and title from the Youtube API. Everything is working fine, but I can't show the data - I want to show url and title of the video using json and php only.</p>
  
  <p>My code:</p>
  
  <pre><code> &lt;?php
  $get = file_get_contents("http://gdata.youtube.com/feeds/api/videos?vq=cod&amp;orderby=viewCount&amp;max-results=1&amp;start-index=1&amp;alt=json");
  $decode = json_decode($get, TRUE); // TRUE for in array format
  
  foreach($decode as $res) { 
  
  echo $res['title']['$t'];
  }
  ?&gt;
  </code></pre>