CodeIgniter Forums
Discovering HTTP verb in Controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Discovering HTTP verb in Controller (/showthread.php?tid=23390)



Discovering HTTP verb in Controller - El Forum - 10-09-2009

[eluser]Lister[/eluser]
Me again :-)

I understand that URI's map to methods in a controller, but how do you determine what HTTP verb was used to invoke the method?

I plan to implement a RESTful type service, so I'll need to do different things depending on GET, POST, DELETE etc.

Cheers,
Lister


Discovering HTTP verb in Controller - El Forum - 10-09-2009

[eluser]Phil Sturgeon[/eluser]
You might be interested in my post on a REST implementation I put together for CodeIgniter.

Even if you don't use the whole thing you can pick through the code and use certain bits.

Specifically, the answer to the question is:

Code:
$this->input->server('REQUEST_METHOD'));



Discovering HTTP verb in Controller - El Forum - 10-09-2009

[eluser]Lister[/eluser]
Many thanks. Haven't had a chance to look over your code yet but at a brief glance it looks like you've put a lot of thought into it so I'll definitely be having a look at your conclusions. Big Grin