Request::processRequest Parameters


#1

Hi there,

Quick question about the Request::processRequest method. I’m not sure if I’m using it correctly. I’m reading the documentation here:
http://developer.piwik.org/api-reference/Piwik/API/Request#processrequest

According to that link, the parameter $defaultRequest should default to the $_GET and $_POST values but this doesn’t seem to be the case.

The source code is as follows:


 public static function processRequest($method, $paramOverride = array(), $defaultRequest = null)
{
  $params = array();
  $params['format'] = 'original';
  $params['module'] = 'API';
  $params['method'] = $method;
  $params = $paramOverride + $params;
  // process request
  $request = new Request($params, $defaultRequest);
  return $request->process();
}

Should this not also include $_GET and $_POST variables like ‘period’ and ‘date’?


(Matthieu Aubry) #2

Should this not also include $_GET and $_POST variables like ‘period’ and ‘date’?

It should include _GET and _POST this is done in the core/API/Request object.
it will include _GET and _POST only when you leave $defaultRequest to null

hope it helps