title: Parsing JSON from URL with PHP
body: <p>After googling, implementing code upon code, I still cannot get ANYTHING to display. Nothing. Not one thing.</p>
  
  <p>I have a URL spitting out JSON:</p>
  
  <pre><code> {"videos":[{"video":{"name":"Sanyo Zio","youtube":"FxxLDr--R5A","post_date":"2010-10-08 01:00:00",...
  </code></pre>
  
  <p>Here's the code I'm using to access the page:</p>
  
  <pre><code> $url = file_get_contents("http://[website]/json/test.json");
  
   $arr = json_decode($url,true);
  </code></pre>
  
  <p>Now here's a short list of what I've tried to access ANY data from the page:</p>
  
  <p>1:</p>
  
  <pre><code> print_r($arr);
  </code></pre>
  
  <p>2:</p>
  
  <pre><code> foreach($arr['videos']['video'] as $item) {
     echo "Name: ". $item[0] ."&lt;br&gt;"; 
   }
  </code></pre>
  
  <p>3:</p>
  
  <pre><code> $obj = $arr[0];
   echo $obj;
  </code></pre>
  
  <p>4:</p>
  
  <pre><code> foreach($arr as $a){
     echo "Name: ".$a['videos']['video']['name']."&lt;br /&gt;";
   }
  </code></pre>
  
  <p>Clearly I'm missing something, but I just haven't been able to figure out what I'm doing wrong! Is my encoding not correct? Here's how I'm encoding the JSON to begin with:</p>
  
  <pre><code> $arr = array('videos' =&gt; array());
   foreach($vid as $items){
    $arr['videos'][] = array('video' =&gt; array(
      'name' =&gt; $items['videoName'], 'youtube' =&gt; $items['youtubeID'], 'post_date' =&gt; $items['productionTimestamp'], 'description' =&gt; $items['videoDesc'], 'link' =&gt; $single_linker_values['deeplink'], 'image' =&gt; $image));
   }
   echo json_encode($arr);
  </code></pre>
  
  <p>Any ideas/suggestions?</p>
  
  <hr>
  
  <p>Update - Apparently the server is locked down, but being inhouse I don't notice :) Obviously the webpage does! Thanks for the help!</p>