title: Decoding JSON input in PHP
body: <pre><code>&lt;?php
  $json = file_get_contents('http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&amp;user=XXXXX&amp;api_key=XXXX&amp;format=json');
  $track_data = json_decode($json);
  
  
      foreach ($track_data as $data)
      {
          if (!empty($data)) {
              $text = $data-&gt;recenttracks-&gt;track-&gt;artist-&gt;mbid;
          }
          echo '&lt;span&gt;'; echo $text; echo '&lt;/span&gt;';
      }
  ?&gt;
  </code></pre>
  
  <p>This is the code I'm trying to use. The problem is: nothing shows up... What's wrong with it? :) Here's the JSON input (the content of the URL on file_get_contents): <a href="http://pastebin.com/NLHGMapT" rel="nofollow">http://pastebin.com/NLHGMapT</a></p>