curl-library
Re: Detail error information on error
Date: Tue, 21 Jan 2014 18:58:14 -0500
On Tue, Jan 21, 2014 at 05:46:07PM -0600, Kevin Burton wrote:
> I don't know what version of lib curl PHP uses. I am using PHP 5.5. I included a snippet of PHP code to show how I was getting the results. I am just faced with the problem that curl_exec returns false on error and I am not sure how to get the response body contents that I can see are available with Fiddler.
> I know there is a PHP layer in between me and libcurl. I don't know how or what to call to give me the results that I would like. Maybe like you indicated there are some options that would cause the body to be "visible" on error?
I suspect you're using the php-only option CURLOPT_RETURNTRANSFER. If
you read the documentation, this causes curl_exec to return false when
an error occurs. If you disable this and instead use a write callback,
you'll be able to inspect the body separately from the response code.
> > On Jan 21, 2014, at 5:00 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> >
> >> On Tue, 21 Jan 2014, rkevinburton_at_charter.net wrote:
> >>
> >> It has to be different. When it is successful I read the response from the result of curl_exec like:
> >
> > First you don't use libcurl directly you use a layer in between that may cause something to differ. But more importantly, you can alter libcurl's behavior by setting options and in particular I think of CURLOPT_FAILONERROR.
> >
> > As you're not telling us any details: no code, no libcurl versions, no platform info, nothing - there could probably be a bazillion other reasons for what you see.
> >
> > --
> >
> > / 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
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-22