title: PHP: file_get_contents('php://input') returning string for JSON message
body: <p>I am trying to read in a JSON message in my PHP app and this is my php code:</p>
  
  <pre><code>$json = file_get_contents('php://input');
  $obj = json_decode($json, TRUE);
  echo $obj-&gt;{'S3URL'};
  </code></pre>
  
  <p>When I do this I am getting the following error:</p>
  
  <pre><code>Trying to get property of non-object in setImage.php on line 25 (line 25 is the echo $obj-&gt;{'S3URL'}; line)
  </code></pre>
  
  <p>This is the request body of the request to the page:</p>
  
  <pre><code>Request Url: http://localhost:8888/setImage.php
  Request Method: POST
  Status Code: 200
  Params: {
     "S3URL": "http://url.com"
  }
  </code></pre>
  
  <p>This is the request headers:</p>
  
  <pre><code>Accept: application/json
  Content-Type: application/json
  Connection: keep-alive
  Origin: chrome-extension: //rest-console-id
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML,
  </code></pre>
  
  <p>However, if I instead echo out the <code>$json</code> variable I get the following:</p>
  
  <pre><code>S3URL=http%3A%2F%2Furl.com
  </code></pre>
  
  <p>So it looks like <code>file_get_contents('php://input');</code> is reading it in as a string, and not as JSON, which will make parsing it more difficult.</p>
  
  <p>Any idea why it isn't being returned as JSON, or how I can get it to be returned as JSON?</p>