mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT you can now pass arbitrary CURL options to the request() method of RestfulService. (from r98656)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102770 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
55c4c90652
commit
f660634cc9
@ -101,7 +101,7 @@ class RestfulService extends ViewableData {
|
|||||||
*
|
*
|
||||||
* This is a replacement of {@link connect()}.
|
* 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
|
$url = $this->baseURL . $subURL; // Url for the request
|
||||||
if($this->queryString) {
|
if($this->queryString) {
|
||||||
if(strpos($url, '?') !== false) {
|
if(strpos($url, '?') !== false) {
|
||||||
@ -156,6 +156,9 @@ class RestfulService extends ViewableData {
|
|||||||
curl_setopt_array($ch, $this->proxy);
|
curl_setopt_array($ch, $this->proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set any custom options passed to the request() function
|
||||||
|
curl_setopt_array($ch, $curlOptions);
|
||||||
|
|
||||||
// Run request
|
// Run request
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
$responseBody = curl_exec($ch);
|
$responseBody = curl_exec($ch);
|
||||||
|
Loading…
Reference in New Issue
Block a user