How can I get "token" param from PUT request?
Controller:
public function actionUpdate()
{
$params = Yii::$app->getRequest()->getBodyParams();
return $params;
}
Request:
curl -X PUT -H "Authorization: Bearer LL_nACyYVJFJyuHJxcOtiXu3OVNBJ_xo" -F "token=12345" "http://localhost/api/v1/devices/1"
Response:
{"success":true,"data":{"--------------------------580af3364bd175a7\r\nContent-Disposition:_form-data;_name":"\"token\"\r\n\r\n12345\r\n--------------------------580af3364bd175a7--\r\n"}}r
I have tried this:
return $params['token'];
PHP Notice: Undefined index: token
And this
parse_str(file_get_contents("php://input"), $params);
Will return the same result