title: Correct headers for PHP RESTful Application?
body: <p><strong>Goal:</strong> A RESTful API<br>
  <strong>Question:</strong> Is the method I have below a true RESTful API or is it missing something like I was told?<br>
   This is a 3 part question..</p>
  
  <p>Let's assume I have a PHP project that has an API that returns data in either XML or JSON formats, you would access the API like this below...</p>
  
  <pre><code>server.com/article/123 | Returns ID 123 using GET
  server.com/article/new | Creates a new article using POST
  server.com/article/123/edit | Edits an article with the ID 123 using POST
  server.com/article/123/delete | Deletes article with ID 123 using POST
  </code></pre>
  
  <p><strong>1)</strong><br>
  I always read also that <code>PUT</code> should be used for editing objects, below I put the word <code>POST</code> as the user would send a <code>POST</code> to tht URI for the delete action, should I be using <code>PUT</code> in php by using something like this instead?</p>
  
  <pre><code>$_PUT  = array();  
  if($_SERVER['REQUEST_METHOD'] == 'PUT') {  
      parse_str(file_get_contents('php://input'), $_PUT);  
  }
  </code></pre>
  
  <p><strong>2)</strong><br>
  I was told in a question I wrote on SO a while back that this is similar to a RESTful API but that it is not, the answer I got was this...</p>
  
  <p><code>In short, your service is not RESTful, but it is close. Rather than specify actions (edit, delete, ...) in URL segments, you will want to make use of HTTP verbs (GET, PUT, POST, DELETE).</code></p>
  
  <p>Either the guy did not know what he was talking about or I just DO NOT GET IT, after reading countless articles on the subject, and comparing with every API I can find, how is my example above NOT RESTful?</p>
  
  <p>I would like to make a RESTful API, please help me correct my example above if needed?</p>
  
  <p><strong>3)</strong><br>
  Also assuming I plan returning a JSON response to the user with something like this...</p>
  
  <pre><code>&lt;?php
  header('HTTP/1.1 200 OK');  
  header('Content-type: application/json');
  
  $data = // my code that returns the appropriate data;
  
  echo json_encode($data);
  ?&gt;
  </code></pre>
  
  <p>Is that the correct way of returning the result to a user or am I missing something? 
   Many articles and questions talk about the concept but don't get into the actual code like my examples.</p>