cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Detail error information on error

From: <rkevinburton_at_charter.net>
Date: Tue, 21 Jan 2014 17:49:40 -0500 (EST)

Thank you.

It has to be different. When it is successful I read the response from
the result of curl_exec like:

             $result = curl_exec($this->_ch);
             $jsonresult = json_decode($result);

But when there is an error curl_exec just returns false without any
detail.

             $result = curl_exec($this->_ch);
             if( $result === false)
             {
                 $info = curl_getinfo($this->_ch);
                 $errormsg = 'ModifyPresentationProperty error: ' .
curl_error($this->_ch);
                 throw new \Exception($errormsg);
             }

On Tue, Jan 21, 2014 at 4:33 PM, Daniel Stenberg wrote:

> On Tue, 21 Jan 2014, rkevinburton_at_charter.net wrote:
>
>> I am using CURL that comes with PHP. I know about curl_error. I am
>> finding that when I get a 500 error from a particular server not only
>> do I get a 500 error but the server puts detail information about the
>> error in the body of the error response. How do I get at the error
>> data using curl in PHP?
>
> The HTTP response body is received the exact same way even if the
> status code is 200 or 500 as in your case. You get the same data the
> same way.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-21