How to send DELETE request to phil sturgeon's - codeigniter-restserver
codeigniter, php, rest
Solution
According the the HTTP spec DELETE cannot send parameters. It can have things in the URL, so you could change this to:
public function user_delete($id)
{
$this->response(array(
'returned from delete:' => $id,
));
}
Problem
As the title says, I'm using Codeigniter with phil sturgeon - codeigniter-restserver framework. I've followed the tutorial on Nettus and everything works fine Except when sending a DELETE request. Code: ``` <?php require(APPPATH.'libraries/REST_Controller.php'); class Client extends REST_Controller{ function user_get() { $data = array('returned:'=> $this->get('id')); $this->response($data); } function user_post() { $data = array('returned:'=> $this->post('id')); $this->response($data); } function user_put() { $data = array('returned:'=> $this->put('id')); $this->response($data); } function user_delete() { $data = array('returned from delete:'=> $this->delete('id')); $this->response($data); } } ``` I'm using a FF Addon called HTTP Resource test, to send the request but when i send a DELETE request with this URL: `http://localhost/api/client/user/id/1`, I get {"returned from delete:":false} As a side note : I found this post and using the 'X-HTTP-Method-Override' header and sending it as a post request i was able to get the id, but I preffer a way where the client does not have to add this header.