Re: CURL body on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Have you tried curl_error() function from the php official documentation?


On Wed, Jan 22, 2014 at 4:40 PM, <rkevinburton@xxxxxxxxxxx> 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.
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux