title: PHP get PUT request body
body: <p>I'm currently developing a Restful Json-API in PHP. I want to send a PUT-Request to <code>items/:id</code> to update a record. The data will be transferred as <code>application/json</code>.</p>
  
  <p>I want to call the API with</p>
  
  <pre><code>curl -H "Content-Type: application/json" -X PUT -d '{"example" : "data"}' "http://localhost/items/someid"
  </code></pre>
  
  <p>On the server side, I'm not able the retrieve the request body. I tried</p>
  
  <pre><code>file_get_contents("php://input");
  </code></pre>
  
  <p>but this returns an empty string. Also a <code>fopen()</code>/<code>fread()</code> combination doesn't work.</p>
  
  <p>When calling via POST, everything works great, I can read the json perfectly on the server side. But the API isn't Restful anymore. Does anyone have a solution for this? Is there another way to send and receive Json?</p>
  
  <p>btw, I'm developing the API with the <a href="http://www.slimframework.com/" rel="noreferrer">Slim Framework</a>.</p>