Search code examples
fuelphp

how to allow post request from app in fuelphp


I'm going to send a post request to fuelphp controller from my android app. but the controller does not accept post requests. is there any way to allow the controller to accept post requests from my app??

thanks


Solution

  • first of all check your fuel configuration about csrf

     'csrf_autoload_methods'    => array('post', 'put', 'delete'),
    

    then you should use restcontroller

    class Controller_Test extends Controller_Rest
    {
    
        public function get_list()
        {
            return $this->response(array(
                'foo' => Input::get('foo'),
                'baz' => array(
                    1, 50, 219
                ),
                'empty' => null
            ));
        }
    }