cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTPS POST

From: Alex Kelly <mail_at_aekelly.com>
Date: Tue, 09 May 2006 17:45:22 -0400

> On Tue, May 09, 2006 at 04:53:35PM -0400, Alex Kelly wrote:
>> It sounds like I could just discard the response data (the downloaded
>> remote webpage), then create an if/else statement to check if there is
>> response data.
>>
>> If response data, then POST was successful...else no response data, POST
>> was unsuccessful.
>
> You're likely to get response data whether the POST was successful or not,
> such as a message saying "You are not authorized to POST". Better to
> check
> the HTTP response code CURLINFO_RESPONSE_CODE (as well as the value
> returned
> by curl_easy_perform, of course).
>
>>>> Dan

I didn't know about CURLINFO_RESPONSE_CODE, but I just looked it up. Looks
like it returns 1 or 0 (if I read it right). So, testing the value is an
easily coded check.

So far, I've been dividing the results of curl_easy_perform using a loop
with strtok and the newline character, '\n'. I could make an if statement
using strstr to look for the string "not authorized" or whatever the
remote server is returning on failure in the results (worth a shot).
Received on 2006-05-09