We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

getPUT not working in Phalcon 3.2

I am developing REST API. In my routes.php file the routes are configured like this :

$usersCollection->put('/{name}', 'update');

In my controller I am trying to access the request parameters like : $id=$this->request->getPut('id');

but $id always returns NULL.

I am using Phalcon 3.2 with PHP 7.0.19 running on Nginx. Could anybody help me in this regard.

edited Jun '17

Are you should you want to access raw body(get put is accessing raw body)? Maybe you want json request? Then use $this->request->getJsonRawBody(true)



5.8k

Are you should you want to access raw body(get put is accessing raw body)? Maybe you want json request? Then use $this->request->getJsonRawBody(true)

No parsing of response is difficult. The way i can have getPost working, is there any way to have getPut working? This method is there in the doumentation.

edited Jun '17

Yes but it's using RAW REQUEST BODY, without json_encode. It's for example form data send using put i guess, if you are sending json body then you need to use getJsonRawBody

I guess it could be good to add some method like getJsonPut() ?