]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/curl/docs/examples/simplepost.c
hello world
[icculus/iodoom3.git] / neo / curl / docs / examples / simplepost.c
1 /*****************************************************************************
2  *                                  _   _ ____  _     
3  *  Project                     ___| | | |  _ \| |    
4  *                             / __| | | | |_) | |    
5  *                            | (__| |_| |  _ <| |___ 
6  *                             \___|\___/|_| \_\_____|
7  *
8  * $Id: simplepost.c,v 1.1 2002/06/19 12:30:12 bagder Exp $
9  */
10
11 #include <stdio.h>
12 #include <curl/curl.h>
13
14 int main(void)
15 {
16   CURL *curl;
17   CURLcode res;
18
19   char *postthis="moo mooo moo moo";
20
21   curl = curl_easy_init();
22   if(curl) {
23     curl_easy_setopt(curl, CURLOPT_URL, "http://posthere.com");
24     curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
25
26     /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
27        itself */
28     curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(postthis));
29
30     res = curl_easy_perform(curl);
31
32     /* always cleanup */
33     curl_easy_cleanup(curl);
34   }
35   return 0;
36 }