ENHANCEMENT you can now pass arbitrary CURL options to the request() method of RestfulService.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98656 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2010-02-10 03:17:58 +00:00 committed by Sam Minnee
parent 0cffea71e9
commit f685cf956d

View File

@ -109,7 +109,7 @@ class RestfulService extends ViewableData {
*
* This is a replacement of {@link connect()}.
*/
public function request($subURL = '', $method = "GET", $data = null, $headers = null) {
public function request($subURL = '', $method = "GET", $data = null, $headers = null, $curlOptions = array()) {
$url = $this->baseURL . $subURL; // Url for the request
if($this->queryString) {
if(strpos($url, '?') !== false) {
@ -164,6 +164,9 @@ class RestfulService extends ViewableData {
curl_setopt_array($ch, $this->proxy);
}
// Set any custom options passed to the request() function
curl_setopt_array($ch, $curlOptions);
// Run request
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$responseBody = curl_exec($ch);