Request API Documentation
SoPHIE Request API Class
The Request API provides access to parameters passed with the current HTTP request.
Init: $requestApi = $api->get('sophie_request');
Method: $requestApi->hasParam(...)
Check whether the HTTP requests has a value for the specified parameter.
Parameters:
- String $parameterName
Returns Boolean True if the parameter extsis and has avalue other than null, false otherwise.
Method: $requestApi->getParam(...)
Get the value for the specified parameter.
Parameters:
- String $parameterName
- String $defaultValue
Returns String Parameter value if is is set, the passed defaultValue otherwise.
Method: $requestApi->getParams(...)
Get all parameter values.
Returns Array Associative array of parameters names and values
Method: $requestApi->getHeader(...)
Get the value for the specified header field.
Parameters:
- String $headerName
Returns String|false Header value if is is set, false otherwise.
Method: $requestApi->getMethod(...)
Get the request method.
Returns String Request method.
Method: $requestApi->isXmlHttpRequest(...)
Check header for AJAX Request indication.
Returns Boolean True if the request is an ajax request, false otherwise.
Method: $requestApi->isSecure(...)
Check request protocol for secure HTTPS connection.
Returns Boolean True if the request was made over a HTTPS connection, false otherwise.
Method: $requestApi->getClientIp(...)
Get Client IP Adress try to check for proxies
Returns String IP-Adress
Method: $requestApi->isGet(...)
Check if request method is GET
Returns Boolean Return true if the request method is GET
Method: $requestApi->isPost(...)
Check if request method is POST
Returns Boolean Return true if the request method is POST
Method: $requestApi->getRawBody(...)
Get the raw POST data
Returns String|false
Method: $requestApi->getJsonBody(...)
Get the decoded JSON raw POST data
Returns Array