diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_POSTFIELDS.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_POSTFIELDS.3 | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 b/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 index b410bf6e8..d3a9ec3d1 100644 --- a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 +++ b/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 @@ -58,7 +58,22 @@ NULL .SH PROTOCOLS HTTP .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + const char *data = "data to send"; + + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* size of the POST data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L); + + /* pass in a pointer to the data - libcurl will not copy */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); + + curl_easy_perform(curl); +} +.fi .SH AVAILABILITY Always .SH RETURN VALUE |