cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PUT data (not file) - can't make it work

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 12 Mar 2008 09:31:55 +0100 (CET)

On Tue, 11 Mar 2008, Tiberiu Motoc wrote:

> I'm trying to perform a PUT and send some string data. There are examples
> out there which show PUT with a file, or POST with string data, but I can't
> find anything for PUT with string data.

What exactly is the difference? libcurl will use a read callback to get the
data when it sends a PUT, you decide how that data is got or what data to
copy to libcurl.

>> From the command line, you would execute something like this:
> curl -X PUT -d "user[age]=26" http://localhost:3000/users/30 -v

This is a POST in which you've changed the method keyword to PUT. A "normal"
PUT with curl is made with -T without the use of -X or -d.

> size_t CInternetRes::put_callback(void* buffer, size_t size, size_t nmemb,

Just note that C++ methods needs to be static to be able to serve as callbacks
directly.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-03-12