title: PHP check whether Incoming Request is JSON type
body: <p>Is there anyway to check whether an incoming request is of AJAX JSON type?</p>
  
  <p>I tried</p>
  
  <pre><code>if(($_SERVER['REQUEST_METHOD']=='JSON'))
  {
  }
  </code></pre>
  
  <p>But it didn't work.</p>
  
  <p>Any thoughts?</p>