Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / docs / examples / simplepost.c
blob56af2a72594d5382322b6750eef5c9bf5de12e68
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: simplepost.c,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
9 */
11 #include <stdio.h>
12 #include <string.h>
13 #include <curl/curl.h>
15 int main(void)
17 CURL *curl;
18 CURLcode res;
20 static const char *postthis="moo mooo moo moo";
22 curl = curl_easy_init();
23 if(curl) {
24 curl_easy_setopt(curl, CURLOPT_URL, "http://posthere.com");
25 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
27 /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
28 itself */
29 curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis));
31 res = curl_easy_perform(curl);
33 /* always cleanup */
34 curl_easy_cleanup(curl);
36 return 0;