/** * Construct the request to be verified * * @param string request * @param string method * @param array params The request parameters */ function __construct($uri = null, $method = null, $params = null) { if ($params) { $encodedParams = array(); foreach ($params as $key => $value) { if (preg_match("/^oauth_/", $key)) { continue; } $encodedParams[rawurlencode($key)] = rawurlencode($value); } $this->param = array_merge($this->param, $encodedParams); } $this->store = OAuthStore::instance(); parent::__construct($uri, $method); LingotekOAuthRequestLogger::start($this); }
/** * Construct the request to be signed. Parses or appends the parameters in the params url. * When you supply an params array, then the params should not be urlencoded. * When you supply a string, then it is assumed it is of the type application/x-www-form-urlencoded * * @param string request url * @param string method PUT, GET, POST etc. * @param mixed params string (for urlencoded data, or array with name/value pairs) * @param string body optional body for PUT and/or POST requests */ function __construct($request, $method = null, $params = null, $body = null) { $this->store = OAuthStore::instance(); if (is_string($params)) { parent::__construct($request, $method, $params); } else { parent::__construct($request, $method); if (is_array($params)) { foreach ($params as $name => $value) { $this->setParam($name, $value); } } } // With put/ post we might have a body (not for application/x-www-form-urlencoded requests) if (strcasecmp($method, 'PUT') == 0 || strcasecmp($method, 'POST') == 0) { $this->setBody($body); } }