cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to extract a header value from a POST response

From: Javier Gálvez Guerrero <javier.galvez.guerrero_at_gmail.com>
Date: Fri, 18 Mar 2011 11:16:33 +0100

Hi,

I am writing a simple module that sends a POST message to a server and
extracts the value of the 'data' parameter of the response message.
Following the curl tutorial guidelines, I have implemented the POST message
sending like this:

int
send_data(CURL* curl, char* URL, char* data)
{
CURLcode res;

curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(data));

res = curl_easy_perform(curl);

return res;
}

However, I do not know how to extract response headers. Should I set any
option to the easy handler? I have read the tutorial but I do not get any
answer to such issue. Any help would be really appreciated.

Thank you,
Javier

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-18