title: When to use header('Content-Type: application/json') in PHP
body: <p>I've been trying to figure out what's really the usage of <code>header('Content-Type: application/json')</code> in php scripts and I've found different questions and answers on stackoverflow about this subject but I still don't completely get it...</p>
  
  <p>So here's the question : I've seen in some php projects this line of code, and I'm trying to understand </p>
  
  <ul>
  <li>if this is used when another web page is calling this actual script (with ajax for example) so that the calling page can get a json from the php page</li>
  </ul>
  
  <p>OR </p>
  
  <ul>
  <li>if this script means that the php page is going to deal with json sent from another web page. Or maybe something else ???</li>
  </ul>
  
  <p>Another thing that could help me if answered, lately I've been retrieving json from a resource (external url) with cURL and I had to put this header (Content-type:application/json) in the request. Did I send this header to the exertnal resource or was this MY header so that I can deal with the returned json ?</p>
  
  <p>thanks</p>