title: Help with consuming JSON feed with PHP & json_decode
body: <p>I've having an issue with consuming a particular feed for a client. They have given me a remote URL and the response is a JSON string like so:</p>
  
  <pre><code>{"affiliate": [
  {"ID":"1", "COUNTRY":"EXAMPLE", "NETWORK":"EXAMPLE", "PRIMARY":"EXAMPLE"},
  {"ID":"2", "EXAMPLE":"EXAMPLE", "COUNTRY":"EXAMPLE", "NETWORK":"EXAMPLE", "PRIMARY":"EXAMPLE"},
  {"ID":"3", "TITLE":"EXAMPLE", "COUNTRY":"EXAMPLE", "NETWORK":"EXAMPLE", "PRIMARY":"EXAMPLE"}
  ]}
  </code></pre>
  
  <p>For example purposes, I've shrank the feed to show the format, but in actuality there are hundreds of affiliates. Anyway, I want to use PHP json_decode because in the end, I need these affiliates in an associative array.</p>
  
  <p>I've got something like this, but I just end up getting the raw string, and json_decode doesn't actually parse it into an associative array.</p>
  
  <pre><code>$request_url = "http://exampleurl.com/feed"; //returns feed like above
  
  $json = file_get_contents($request_url, true); //getting the file content
  
  $decode = json_decode($json, true);
  
  print_r($decode);
  </code></pre>
  
  <p>It seems like I need to maintain the "\n" characters in the feed itself, but these get stripped out when using:</p>
  
  <pre><code>file_get_contents
  </code></pre>
  
  <p>Anyway, I think you know what I'm after, I'm just not sure what I'm doing wrong. I appreciate the help in advance. I've tried using jquery with jsonp but it would be more ideal this way since I need to sort through the array afterward and it doesn't need to be asynchronous.</p>
  
  <p>Acorn</p>