I have a function that returns the request parameters for each request:
private function GetRequestParams() {
$method = $_SERVER['REQUEST_METHOD'];
switch (strtolower($method)) {
case 'put':
$this->requestParams = //parse_str(HttpResponse::getRequestBody())
$this->requestParams = array_map('urldecode', $this->requestParams);
break;
case 'post':
$this->requestParams = $_REQUEST;
break;
case 'get':
$this->requestParams = $_GET;
break;
case 'delete':
$this->requestParams = $_REQUEST;
break;
default:
$this->requestParams = $_REQUEST;
}
}
but when I call the same url with GET and POST, the $_POST parameters are empty. I use WizTools RestClient and the Apache Server from XAMPP tools to call the following url:
http://localhost:80/project/?item=1
For GET the request params correctly contain the “item”, but for POST, the request params are empty.
It seems that the post method is correctly detected as the following function, sends correctly to postDescription() method:
$method = strtolower($_SERVER['REQUEST_METHOD']) . 'Description';
I have found an info to edit php.ini post_max_size = 8*M* to 8*MB* but that did not worked for me.
$_GETis populated with data from the URL’s query string.$_POSTis populated with data from the post message’s body.If you make a post request but pass the data in the query string, then the data will appear in
$_GETnot$_POST.