title: file_get_contents("php://input") or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?
body: <p><code>file_get_contents("php://input")</code> or <code>$HTTP_RAW_POST_DATA</code> - which one is better to get the body of JSON request?</p>
  
  <p>And which request type (<code>GET</code> or <code>POST</code>) should I use to send JSON data when using client side <code>XmlHTTPRequest</code>?</p>
  
  <p>My question was inspired from this answer:
  <a href="https://stackoverflow.com/questions/813487/how-to-post-json-to-php-with-curl/813512#813512">How to post JSON to PHP with curl</a></p>
  
  <p>Quote from that answer:</p>
  
  <blockquote>
    <p>From a protocol perspective <code>file_get_contents("php://input")</code> is actually more correct, since you're not really processing http multipart form data anyway.</p>
  </blockquote>