How to get POST and GET requests in Magento 2

- Magento 2

Magento 2 Development

In a case of a controller that extends Magento\Framework\App\Action\Action, it is possible to get the request with the aid of $this->getRequest()->getPost().

For a custom class, inject the request in the constructor:

More tips from Magento 2 Developer’s Cookbook


Source (Magento Stackexchange Question) (Marius)