curl-users
Re: Not Getting Error Messages using curl_easy API in C (New User)
Date: Thu, 17 Nov 2005 20:53:34 -0800 (PST)
Daniel:
Thanks for getting back to me
The code sniplet I provided wasn't quit correct.
I hand typed it rather than cut and paste, thus missing a ')'
I do perform a getinfo after the perform, and I'm not getting it to
return anything. I'm expecting something like a 404?
Is there settings that would affect the outcome of getinfo?
Jamie
Daniel Stenberg <daniel_at_haxx.se> wrote: On Thu, 17 Nov 2005, jamie page wrote:
(consider using the curl-library list for libcurl stuff, it's made for this
purpose!)
> I'm involved in a small project using curl. The goal is to collect pages
> from a local server. When I test with an Invalid URL, I'm hoping to get an
> error to handle. However what I'm getting is an error page downloaded and
> written to disk.
Sure, curl downloads what you ask it.
> Is there away to gain an error code to allow error handling?
yes
> if(curl_easy_getinfo(ctxHttps->curl, CURLINFO_HTTP_CODE, &lCurlResponse
> != CURLE_OK)
Did that code really compile? It is completely wrong. After your transfer, do:
long code;
curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &code);
... and then 'code' will contain the HTTP response code from your request.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.html --------------------------------- Yahoo! FareChase - Search multiple travel sites in one click.Received on 2005-11-18