curl-library
Re: TYPE configuration
Date: Sat, 19 Jan 2002 11:23:20 +0100 (MET)
On Fri, 18 Jan 2002, Cameron Laird wrote:
> How do I POST a text/xml document with libcurl (bound to C, say)? Is there
> a function call I haven't noticed that allows for configuration of
> Content-type?
It isn't extremely obvious in the documentations, but these are the
essentials:
CURLOPT_POSTFIELDS - point out the data to POST
CURLOPT_POSTFIELDSIZE - if the data might contain zero bytes this must set
the length to post
CURLOPT_HTTPHEADER - pointed to a linked list of HTTP headers. I quote from
the curl_easy_setopt man page:
Pass a pointer to a linked list of HTTP headers to
pass to the server in your HTTP request. The linked
list should be a fully valid list of struct
curl_slist structs properly filled in. Use
curl_slist_append(3) to create the list and
curl_slist_free_all(3) to clean up an entire list.
If you add a header that is otherwise generated and
used by libcurl internally, your added one will be
used instead. If you add a header with no contents
as in 'Accept:' (no data on the right side of the
colon), the internally used header will get dis
abled. Thus, using this option you can add new head
ers, replace internal headers and remove internal
headers.
... so a "Content-Type: text/xml" header would probably suit your needs.
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-01-19