title: Handling PUT/DELETE arguments in PHP
body: <p>I am working on my <a href="http://github.com/philsturgeon/codeigniter-restclient" rel="noreferrer">REST client library for CodeIgniter</a> and I am struggling to work out how to send PUT and DELETE arguments in PHP.</p>
  
  <p>In a few places I have seen people using the options:</p>
  
  <pre><code>$this-&gt;option(CURLOPT_PUT, TRUE);
  $this-&gt;option(CURLOPT_POSTFIELDS, $params);
  </code></pre>
  
  <p>Annoyingly, this seems to do nothing. Is this the correct way to set PUT parameters?</p>
  
  <p>If so, how do I set DELETE parameters?</p>
  
  <p><em>$this->option() is part of my library, it simply builds up an array of CURLOPT_XX constants and sends them to curl_setopt_array() when the built up cURL request is executed.</em> </p>
  
  <p>I am attempting to read PUT and DELETE parameters using the following code:</p>
  
  <pre><code>        case 'put':
              // Set up out PUT variables
              parse_str(file_get_contents('php://input'), $this-&gt;_put_args);
          break;
  
          case 'delete':
              // Set up out PUT variables
              parse_str(file_get_contents('php://input'), $this-&gt;_delete_args);
          break;
  </code></pre>
  
  <p>There are two options here, I am approaching this in the wrong way or there is a bug somewhere in my libraries. If you could let me know if this should theoretically work I can just hammer away on debug until I solve it.</p>
  
  <p>I dont want to waste any more time on an approach that is fundamentally wrong.</p>