BUGFIX Update RestfulService so that it still functions if Curl-SSL isn't set up properly

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@51211 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-03-17 09:11:24 +00:00
parent 9ec3e2fd6e
commit 9d025c213a

View File

@ -94,8 +94,18 @@ class RestfulService extends ViewableData {
$this->rawXML = curl_exec($ch);
if($this->rawXML === false) {
user_error("Curl Error:" . curl_error($ch), E_USER_WARNING);
return;
$curlError = curl_error($ch);
// Problem verifying the server SSL certificate; just ignore it as it's not mandatory
if(strpos($curlError,'14090086') !== false) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$this->rawXML = curl_exec($ch);
$curlError = curl_error($ch);
}
if($this->rawXML === false) {
user_error("Curl Error:" . $curlError, E_USER_WARNING);
return;
}
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);