Merge pull request #42 from mremi/handle-request-options

Handled additional request options
This commit is contained in:
Francis Besset 2014-07-10 16:16:27 +02:00
commit ccc4d57501
2 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -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.
*