HTTP request handling
ImpressPages has functions for handling HTTP GET and POST requests.
Use ipRequest() function to get HTTP request data for your plugins. This function returns an object of \Ip\Request class. Here are some frequently used methods provided by this class:
Retrieve POST request value
$valuesArray = ipRequest()->getPost(); // Retrieves all variables $value = ipRequest()->getPost('myVariable'); // Retrieve a single variable $value = ipRequest()->getPost('myVariable', 'My default value'); // Returns default value if variable was not set.
Retrieve GET request value
$value = ipRequest()->getQuery('myVariable'); $value = ipRequest()->getQuery('myVariable', 'My default value'); // Returns default value if variable was not set.
Retrieve $_REQUEST values
$value = ipRequest()->getRequest('myVariable'); $value = ipRequest()->getRequest('myVariable', 'My default value'); // Returns default value if variable was not set.
Determine whether this is GET or POST method
$value = ipRequest()->isPost(); // or $value = ipRequest()->isGet();