Re: CURL body on error
| From: | Tsvetan Nikolov | Date: | Thu, 23 Jan 2014 09:12:24 +0000 |
| Subject: | Re: CURL body on error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322735@lists.php.net to get a copy of this message | ||
Have you tried curl_error() function from the php official documentation?
On Wed, Jan 22, 2014 at 4:40 PM, <rkevinburton@charter.net> wrote:
>
> 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.
>