Merge pull request #42 from mremi/handle-request-options
Handled additional request options
This commit is contained in:
commit
ccc4d57501
@ -118,10 +118,11 @@ class Curl
|
||||
* @param string $location HTTP location
|
||||
* @param string $request Request body
|
||||
* @param array $requestHeaders Request header strings
|
||||
* @param array $requestOptions An array of request options
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function exec($location, $request = null, $requestHeaders = array())
|
||||
public function exec($location, $request = null, $requestHeaders = array(), $requestOptions = array())
|
||||
{
|
||||
curl_setopt($this->ch, CURLOPT_URL, $location);
|
||||
|
||||
@ -134,6 +135,10 @@ class Curl
|
||||
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $requestHeaders);
|
||||
}
|
||||
|
||||
if (count($requestOptions) > 0) {
|
||||
curl_setopt_array($this->ch, $requestOptions);
|
||||
}
|
||||
|
||||
$this->response = $this->execManualRedirect();
|
||||
|
||||
return ($this->response === false) ? false : true;
|
||||
|
@ -180,11 +180,14 @@ class SoapClient extends \SoapClient
|
||||
|
||||
$headers = $this->filterRequestHeaders($soapRequest, $headers);
|
||||
|
||||
$options = $this->filterRequestOptions($soapRequest);
|
||||
|
||||
// execute HTTP request with cURL
|
||||
$responseSuccessfull = $this->curl->exec(
|
||||
$location,
|
||||
$content,
|
||||
$headers
|
||||
$headers,
|
||||
$options
|
||||
);
|
||||
// tracing enabled: store last request header and body
|
||||
if ($this->tracingEnabled === true) {
|
||||
@ -273,6 +276,18 @@ class SoapClient extends \SoapClient
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds additional cURL options for the request
|
||||
*
|
||||
* @param SoapRequest $soapRequest SOAP request object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterRequestOptions(SoapRequest $soapRequest)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last request HTTP headers.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user