title: Parsing iTunes json, then displaying it on webpage, and caching it with PHP
body: <p>I'm working on a project where I need to get info from iTunes, cache it, and display it on a webpage with PHP.  I prefer to use curl, since it seems faster, but I'm more familiar with get_file_contents.  An example of the json url is <a href="http://itunes.apple.com/lookup?id=284910350" rel="nofollow">http://itunes.apple.com/lookup?id=284910350</a>.  I'm able to grab and decode it, but I'm having trouble from there.</p>
  
  <p>Here's my start:</p>
  
  <pre><code>&lt;?php
  
      $cas = curl_init('http://itunes.apple.com/lookup?id=284910350');
      curl_setopt($cas, CURLOPT_RETURNTRANSFER, 1);
      $jsonitunes = curl_exec($cas);
      curl_close($cas);
  
      $arr = json_decode($jsonitunes,true);
      foreach($arr as $item) {
          echo "kind: ". $item['kind'] ."&lt;br&gt;"; 
      }
  
  
  ?&gt;
  </code></pre>
  
  <p>I can print the array, or var_dump it, but can't seem to grab any values.  After that, I need to cache the whole thing.  If possible, I'd like to set it up to grab new content when it arrives, or on a frequent schedule without weighing down the server.</p>