diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 08:58:03 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 08:58:24 +0200 |
commit | c857bb68ec37f82b62238fca73942e6ede8bd8f7 (patch) | |
tree | 084c1ff2355e2b3ce77c8a69bec4657a78cbfcc2 /docs/libcurl/opts/CURLOPT_POSTREDIR.3 | |
parent | 005f2adaaa8025849760b30289e06916ea25f548 (diff) | |
download | curl-c857bb68ec37f82b62238fca73942e6ede8bd8f7.tar.gz |
opts: added examples
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_POSTREDIR.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_POSTREDIR.3 | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 b/docs/libcurl/opts/CURLOPT_POSTREDIR.3 index b9660a944..aa36bd0f5 100644 --- a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 +++ b/docs/libcurl/opts/CURLOPT_POSTREDIR.3 @@ -47,9 +47,23 @@ when setting \fICURLOPT_FOLLOWLOCATION(3)\fP. .SH DEFAULT 0 .SH PROTOCOLS -HTTP +HTTP(S) .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* a silly POST example */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data=true"); + + /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and + 303 HTTP response codes */ + curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); + + curl_easy_perform(curl); +} +.fi .SH AVAILABILITY Added in 7.17.1. This option was known as CURLOPT_POST301 up to 7.19.0 as it only supported the 301 then. CURL_REDIR_POST_303 was added in 7.26.0. |