cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to "PUT" http body to HTTP PUT in libcurl

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 25 Jan 2016 21:53:19 +0100

On Mon, Jan 25, 2016 at 12:41:27PM -0500, cnm marketing wrote:
> Hi,
>
> I have the following http put, how do I useĀ curl_easy_setopt( ) to set it.
> Notice that the body portion is just a Json text string.
>
> //url
> HTTP PUT https://xxxxxx/object?name=xyz
> // body
> {
> "bodayField":"abcd"
> }
>
> CURLOPT_READDATA andĀ CURLOPT_INFILESIZE_LARGE is for reading a file.

Who says it's for reading a file? It can be used for data from any source. Take
a look at the post-callback.c example program, for example. Changing the
CURLOPT_POST to a CURLOPT_PUT ought to get you what you want.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2016-01-25