curl-users
Re: Source Code as requested (Unable to get HTTP_CODE via curl_easy_getinfo)
Date: Fri, 18 Nov 2005 12:13:37 -0800 (PST)
Lars:
You nailed it,, thanks!
Jamie
Lars Nilsson <chamaeleon_at_gmail.com> wrote: On 11/18/05, jamie page wrote:
> if(curl_easy_getinfo(ctxHttps->curl,
> CURLINFO_HTTP_CODE, &lCurlResponse) != CURLE_OK)
> {
> sprintf(strError, "Error in curl_easy_getinfo: %ld", lCurlResponse);
> }
curl_easy_getinfo() return CURLE_OK when it is SUCCESSFUL in its
attempt to get the information you want. Your code will only be called
when you did NOT get the HTTP request code (i.e., more or less never).
Add another if() after this one where you explicitly check
lCurlResponse for values that make sense for your application and
create your error string when it does not have an acceptable value
(like 404).
Lars Nilsson
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
Received on 2005-11-18