The code below is a simple example which sends a
PUT request, using the API from
<ne_basic.h>:
#include <stdio.h>
#include <stdlib.h>
#include <ne_basic.h>
static const char data[] = "Example data.\n";
int main(int argc, char **argv)
{
ne_session *sess;
int ec = EXIT_SUCCESS;
ne_sock_init(); /* Global library initialization. */
sess = ne_session_create("http", "localhost", 80);
if (ne_putbuf(sess, "/dav/data.txt", data, sizeof data)) {
fprintf(stderr, "PUT Request failed: %s\n", ne_get_error(sess));
ec = EXIT_FAILURE;
}
ne_session_destroy(sess);
return ec;
}