curl-library
Re: header mysteries when not using curl_slist_append
Date: Sat, 2 Mar 2013 11:14:58 +0100
On Fri, Mar 01, 2013 at 07:05:33PM -0500, Dennis Clarke wrote:
> > using the http-post.c
> > example code as
> > a basis.
>
> looked at that .. won't work as there are no fields on the end point such as name=foo etc.
>
> However .. I guess I could just shove the entire datastream to be sent into the parameter for CURLOPT_POSTFIELDS. That seems to be what you suggest.
If your server doesn't want fields like name=foo, then don't send those
fields--send what the server expects. Using CURLOPT_POSTFIELDS is the most
straightforward way, but if there's a lot of data to send you can use a
callback function instead (such as in post-callback.c). From your original
post, it looks like you'll want to send a non-default Content-Type
header as well which you'd do with the CURLOPT_HTTPHEADER option.
> hey .. this is a process of try something, fall over, stand up, ask a question, try again, fall over, ask a question .. try something else .. fall over .. stand up.
>
> So yeah .. I get it.
You can do it that way if you want to, but we've written over 59,000 words of
man pages and over 9,000 lines of example programs so you don't have to. If you
feel that there is still something missing after reading that, please let us
know so we can improve it! Lots of people have put a lot of effort into writing
that documentation and example code, so please use it as much as you can.
> also .. in that test example, after this :
>
> /* Perform the request, res will get the return code */
> res = curl_easy_perform(curl);
>
> where is the reply from the server ?
>
> thrown away ?
By default it gets written to stdout. You can send it to another file if
you want, or process it another way using a write callback function (see
getinmemory.c for one example).
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-02