aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples/http-post.c
diff options
context:
space:
mode:
authorLucas Eckels <eckels@google.com>2012-08-06 15:07:02 -0700
committerLucas Eckels <eckels@google.com>2012-08-08 09:28:48 -0700
commit9bd90e6e25f1e55f50201c87a1b5837de7e5b64a (patch)
treed2061a00d7d0ee884170bc955fceeed2d0edf284 /docs/examples/http-post.c
parente6f2b03027b5feb92b30f5d47801ec3fabe9fd95 (diff)
downloadexternal_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.gz
external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.bz2
external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.zip
Add Music Manager's curl 7.21.2 source.
Change-Id: I259a43fa52d581524a5ce8ae1711467acb1d9d50
Diffstat (limited to 'docs/examples/http-post.c')
-rw-r--r--docs/examples/http-post.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/examples/http-post.c b/docs/examples/http-post.c
new file mode 100644
index 00000000..523177d2
--- /dev/null
+++ b/docs/examples/http-post.c
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ */
+
+#include <stdio.h>
+#include <curl/curl.h>
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res;
+
+ curl = curl_easy_init();
+ if(curl) {
+ /* First set the URL that is about to receive our POST. This URL can
+ just as well be a https:// URL if that is what should receive the
+ data. */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi");
+ /* Now specify the POST data */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
+
+ /* Perform the request, res will get the return code */
+ res = curl_easy_perform(curl);
+
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
+ return 0;
+}