|
| __construct ($oauthOptions, $uri=null, $config=null) |
|
| setAdapter ($adapter) |
|
| setStreamingRequest ($value) |
|
| getStreamingRequest () |
|
| resetParameters ($clearAll=false) |
|
| setRawDataStream ($data, $enctype=null) |
|
| setMethod ($method=self::GET) |
|
| request ($method=null) |
|
| prepareOauth () |
|
| __call ($method, array $args) |
|
| __construct ($uri=null, $config=null) |
|
| setUri ($uri) |
|
| getUri ($as_string=false) |
|
| setConfig ($config=array()) |
|
| setMethod ($method=self::GET) |
|
| setHeaders ($name, $value=null) |
|
| getHeader ($key) |
|
| setParameterGet ($name, $value=null) |
|
| setParameterPost ($name, $value=null) |
|
| getRedirectionsCount () |
|
| setAuth ($user, $password='', $type=self::AUTH_BASIC) |
|
| setCookieJar ($cookiejar=true) |
|
| getCookieJar () |
|
| setCookie ($cookie, $value=null) |
|
| setFileUpload ($filename, $formname, $data=null, $ctype=null) |
|
| setEncType ($enctype=self::ENC_URLENCODED) |
|
| setRawData ($data, $enctype=null) |
|
| setUnmaskStatus ($status=true) |
|
| getUnmaskStatus () |
|
| resetParameters ($clearAll=false) |
|
| getLastRequest () |
|
| getLastResponse () |
|
| setAdapter ($adapter) |
|
| getAdapter () |
|
| setStream ($streamfile=true) |
|
| getStream () |
|
| request ($method=null) |
|
Definition at line 40 of file Client.php.
◆ __construct()
__construct |
( |
|
$oauthOptions, |
|
|
|
$uri = null , |
|
|
|
$config = null |
|
) |
| |
Constructor; creates a new HTTP Client instance which itself is just a typical Zend_Http_Client subclass with some OAuth icing to assist in automating OAuth parameter generation, addition and cryptographioc signing of requests.
- Parameters
-
- Returns
- void
Definition at line 77 of file Client.php.
81 $config[
'rfc3986_strict'] =
true;
84 $config[
'rfc3986_strict'] =
true;
88 if ($oauthOptions !==
null) {
90 $oauthOptions = $oauthOptions->toArray();
setOptions(array $options)
◆ __call()
__call |
( |
|
$method, |
|
|
array |
$args |
|
) |
| |
Simple Proxy to the current Zend_Oauth_Config method. It's that instance which holds all configuration methods and values this object also presents as it's API.
- Parameters
-
- Returns
- mixed
- Exceptions
-
Definition at line 321 of file Client.php.
323 if (!method_exists($this->_config,
$method)) {
324 #require_once 'Zend/Oauth/Exception.php'; 327 return call_user_func_array(array($this->_config,
$method), $args);
◆ _getSignableParametersAsQueryString()
_getSignableParametersAsQueryString |
( |
| ) |
|
|
protected |
Collect all signable parameters into a single array across query string and POST body. Don't include POST parameters if content type is multipart POST.
- Returns
- array
Definition at line 299 of file Client.php.
302 if (!empty($this->paramsGet)) {
305 if ($this->enctype != self::ENC_FORMDATA && !empty($this->paramsPost)) {
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ _prepareBody()
Prepare the request body (for POST and PUT requests)
- Returns
- string
- Exceptions
-
Definition at line 143 of file Client.php.
145 if($this->_streamingRequest) {
147 $this->raw_post_data->getTotalSize());
151 return parent::_prepareBody();
setHeaders($name, $value=null)
◆ getStreamingRequest()
Check whether the client is set to perform streaming requests.
- Returns
- boolean True if yes, false otherwise.
Definition at line 128 of file Client.php.
130 if ($this->_streamingRequest) {
◆ prepareOauth()
Performs OAuth preparation on the request before sending.
This primarily means taking a request, correctly encoding and signing all parameters, and applying the correct OAuth scheme to the method being used.
- Returns
- void
- Exceptions
-
Zend_Oauth_Exception | If POSTBODY scheme requested, but GET request method used; or if invalid request scheme provided |
Definition at line 236 of file Client.php.
238 $requestScheme = $this->getRequestScheme();
239 $requestMethod = $this->getRequestMethod();
242 $oauthHeaderValue = $this->getToken()->toHeader(
248 $this->
setHeaders(
'Authorization', $oauthHeaderValue);
250 if ($requestMethod == self::GET) {
251 #require_once 'Zend/Oauth/Exception.php'; 253 'The client is configured to' 254 .
' pass OAuth parameters through a POST body but request method' 258 $raw = $this->getToken()->toQueryString(
263 $this->
setRawData($raw,
'application/x-www-form-urlencoded');
264 $this->paramsPost = array();
269 $queryParts = explode(
'&', $this->
getUri()->getQuery());
270 foreach ($queryParts as $queryPart) {
271 $kvTuple = explode(
'=', $queryPart);
272 $params[urldecode($kvTuple[0])] =
273 (array_key_exists(1, $kvTuple) ? urldecode($kvTuple[1]) : null);
276 if (!empty($this->paramsPost)) {
278 $query = $this->getToken()->toQueryString(
282 $query = $this->getToken()->toQueryString(
286 $this->paramsGet = array();
288 #require_once 'Zend/Oauth/Exception.php';
const REQUEST_SCHEME_HEADER
elseif(isset( $params[ 'redirect_parent']))
setHeaders($name, $value=null)
setRawData($data, $enctype=null)
const REQUEST_SCHEME_QUERYSTRING
_getSignableParametersAsQueryString()
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
const REQUEST_SCHEME_POSTBODY
◆ request()
request |
( |
|
$method = null | ) |
|
Same as Zend_Http_Client::request() except just before the request is executed, we automatically append any necessary OAuth parameters and sign the request using the relevant signature method.
- Parameters
-
- Returns
- Zend_Http_Response
Definition at line 217 of file Client.php.
223 return parent::request();
setMethod($method=self::GET)
◆ resetParameters()
resetParameters |
( |
|
$clearAll = false | ) |
|
Clear all custom parameters we set.
- Returns
- Zend_Http_Client
Definition at line 160 of file Client.php.
162 $this->_streamingRequest =
false;
163 return parent::resetParameters($clearAll);
◆ setAdapter()
Load the connection adapter
- Parameters
-
- Returns
- void
Definition at line 102 of file Client.php.
◆ setMethod()
setMethod |
( |
|
$method = self::GET | ) |
|
Same as Zend_Http_Client::setMethod() except it also creates an Oauth specific reference to the method type. Might be defunct and removed in a later iteration.
- Parameters
-
- Returns
- Zend_Http_Client
Definition at line 191 of file Client.php.
194 $this->setRequestMethod(self::GET);
196 $this->setRequestMethod(self::POST);
198 $this->setRequestMethod(self::PUT);
200 $this->setRequestMethod(self::DELETE);
202 $this->setRequestMethod(self::HEAD);
204 $this->setRequestMethod(self::OPTIONS);
206 return parent::setMethod(
$method);
elseif(isset( $params[ 'redirect_parent']))
◆ setRawDataStream()
setRawDataStream |
( |
|
$data, |
|
|
|
$enctype = null |
|
) |
| |
Set the raw (already encoded) POST data from a stream source.
This is used to support POSTing from open file handles without caching the entire body into memory. It is a wrapper around Zend_Http_Client::setRawData().
- Parameters
-
string | $data | The request data |
string | $enctype | The encoding type |
- Returns
- Zend_Http_Client
Definition at line 177 of file Client.php.
179 $this->_streamingRequest =
true;
setRawData($data, $enctype=null)
◆ setStreamingRequest()
setStreamingRequest |
( |
|
$value | ) |
|
Set the streamingRequest variable which controls whether we are sending the raw (already encoded) POST data from a stream source.
- Parameters
-
boolean | $value | The value to set. |
- Returns
- void
Definition at line 118 of file Client.php.
120 $this->_streamingRequest =
$value;
◆ $_config
◆ $_streamingRequest
$_streamingRequest = null |
|
protected |
◆ $supportsRevisionA
$supportsRevisionA = false |
|
static |
Flag to indicate that the client has detected the server as supporting OAuth 1.0a
Definition at line 46 of file Client.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Oauth/Client.php