title: Returning a JSON result from a PHP REST web service
body: <p>I have a REST web service written in PHP and I'm calling it using a POST request (making use of curl for this). The web service should return a JSON document.
  Problem is, I'm not sure what is the correct way to send this document back to the web service client. Is it sufficient to just echo it out?</p>
  
  <p>Right now it looks like this is the only way in which i can get the JSON document to appear in the result of the POST request (the $result variable):</p>
  
  <pre><code>$result = curl_exec($ch);
  </code></pre>