CURL body on error
| From: | rkevinburton at charter dot net | Date: | Wed, 22 Jan 2014 15:40:25 +0000 |
| Subject: | CURL body on error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-322732@lists.php.net to get a copy of this message | ||
Currently I have code that looks like:
$result = curl_exec($this->_ch);
if( $result === false)
{
$info = curl_getinfo($this->_ch);
$errormsg = 'ModifyPresentationProperty error: ' . curl_error($this->_ch);
throw new \Exception($errormsg);
}
$jsonresult = json_decode($result);
The problem that when there is an error the server puts additional error information in the body of the response ("odata.error"). How do I access the data in the body when there is an error? Right now I only get $result which is false in the event of an error and curl_error only gives me the error code and a string describing the error code. The function curl_info seems to return only information about the request.
This is CURL that comes with PHP 5.5.7. Curl reports version 7.30.0
Thank you.