manpagez: man pages & more
man CURLOPT_POST(3)
Home | html | info | man
CURLOPT_POST(3)            curl_easy_setopt options            CURLOPT_POST(3)




NAME

       CURLOPT_POST - request a HTTP POST


SYNOPSIS

       #include <curl/curl.h>

       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POST, long post);


DESCRIPTION

       A parameter set to 1 tells libcurl to do a regular HTTP post. This will
       also make the  library  use  a  "Content-Type:  application/x-www-form-
       urlencoded"  header.  (This  is  by  far  the  most  commonly used POST
       method).

       Use one of CURLOPT_POSTFIELDS(3) or  CURLOPT_COPYPOSTFIELDS(3)  options
       to  specify  what  data  to  post  and CURLOPT_POSTFIELDSIZE(3) or CUR-
       LOPT_POSTFIELDSIZE_LARGE(3) to set the data size.

       Optionally, you can provide data to POST  using  the  CURLOPT_READFUNC-
       TION(3)  and CURLOPT_READDATA(3) options but then you must make sure to
       not set CURLOPT_POSTFIELDS(3) to anything but NULL. When providing data
       with  a  callback, you must transmit it using chunked transfer-encoding
       or you must set the size of the data with the  CURLOPT_POSTFIELDSIZE(3)
       or  CURLOPT_POSTFIELDSIZE_LARGE(3) options. To enable chunked encoding,
       you simply pass in the appropriate Transfer-Encoding  header,  see  the
       post-callback.c example.

       You  can override the default POST Content-Type: header by setting your
       own with CURLOPT_HTTPHEADER(3).

       Using POST with HTTP 1.1 implies the use of  a  "Expect:  100-continue"
       header.   You  can  disable  this  header with CURLOPT_HTTPHEADER(3) as
       usual.

       If you use POST to a HTTP 1.1 server, you can send data without knowing
       the  size  before  starting  the  POST if you use chunked encoding. You
       enable this by adding a header like "Transfer-Encoding:  chunked"  with
       CURLOPT_HTTPHEADER(3).  With  HTTP 1.0 or without chunked transfer, you
       must specify the size in the request.

       When setting CURLOPT_POST(3) to  1,  it  will  automatically  set  CUR-
       LOPT_NOBODY(3) to 0.

       If  you  issue a POST request and then want to make a HEAD or GET using
       the same re-used handle, you must explicitly set the new  request  type
       using CURLOPT_NOBODY(3) or CURLOPT_HTTPGET(3) or similar.


DEFAULT

       0, disabled


PROTOCOLS

       HTTP


EXAMPLE

       TODO


AVAILABILITY

       Along with HTTP


RETURN VALUE

       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.


SEE ALSO

       CURLOPT_POSTFIELDS(3), CURLOPT_HTTPPOST(3),



libcurl 7.37.0                    17 Jun 2014                  CURLOPT_POST(3)
CURLOPT_POSTFIELDS(3)      curl_easy_setopt options      CURLOPT_POSTFIELDS(3)




NAME

       CURLOPT_POSTFIELDS - specify data to POST to server


SYNOPSIS

       #include <curl/curl.h>

       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDS, char *post-
       data);


DESCRIPTION

       Pass a char * as parameter, pointing to the full data to send in a HTTP
       POST  operation.  You must make sure that the data is formatted the way
       you want the server to receive it. libcurl will not convert  or  encode
       it for you in any way. For example, the web server may assume that this
       data is url-encoded.

       The data pointed to is NOT copied by the library: as a consequence,  it
       must  be  preserved  by  the  calling  application until the associated
       transfer finishes.

       This POST  is  a  normal  application/x-www-form-urlencoded  kind  (and
       libcurl  will  set  that  Content-Type  by  default when this option is
       used), which is commonly used by HTML forms. Change  Content-Type  with
       CURLOPT_HTTPHEADER(3).

       Using CURLOPT_POSTFIELDS(3) implies CURLOPT_POST(3).

       If  you want to do a zero-byte POST, you need to set CURLOPT_POSTFIELD-
       SIZE(3) explicitly to zero, as simply setting CURLOPT_POSTFIELDS(3)  to
       NULL  or  ""  just  effectively  disables  the sending of the specified
       string. libcurl will instead assume that  you'll  send  the  POST  data
       using the read callback!

       Using  POST  with  HTTP 1.1 implies the use of a "Expect: 100-continue"
       header.  You can disable  this  header  with  CURLOPT_HTTPHEADER(3)  as
       usual.

       To  make  multipart/formdata  posts  (aka RFC2388-posts), check out the
       CURLOPT_HTTPPOST(3) option combined with curl_formadd(3).


DEFAULT

       NULL


PROTOCOLS

       HTTP


EXAMPLE

       TODO


AVAILABILITY

       Always


RETURN VALUE

       Returns CURLE_OK


SEE ALSO

       CURLOPT_POSTFIELDSIZE(3), CURLOPT_READFUNCTION(3),



libcurl 7.37.0                    17 Jun 2014            CURLOPT_POSTFIELDS(3)
CURLOPT_POSTFIELDSIZE(3)   curl_easy_setopt options   CURLOPT_POSTFIELDSIZE(3)




NAME

       CURLOPT_POSTFIELDSIZE - size of POST data pointed to


SYNOPSIS

       #include <curl/curl.h>

       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_POSTFIELDSIZE,  long
       size);


DESCRIPTION

       If you want to post data to the server  without  having  libcurl  do  a
       strlen()  to measure the data size, this option must be used. When this
       option is used you can post  fully  binary  data,  which  otherwise  is
       likely  to  fail.  If  this  size  is  set  to -1, the library will use
       strlen() to get the size.

       If you post more than 2GB, use CURLOPT_POSTFIELDSIZE_LARGE(3).


DEFAULT

       -1


PROTOCOLS

       HTTP


EXAMPLE

       TODO


AVAILABILITY

       Along with HTTP


RETURN VALUE

       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.


SEE ALSO

       CURLOPT_POSTFIELDS(3), CURLOPT_POSTFIELDSIZE_LARGE(3),



libcurl 7.37.0                    17 Jun 2014         CURLOPT_POSTFIELDSIZE(3)

CURLOPT_POSTFIELDSIZE_LARGEcurl_easy_setopt optiCURLOPT_POSTFIELDSIZE_LARGE(3)





NAME

       CURLOPT_POSTFIELDSIZE_LARGE - size of POST data pointed to


SYNOPSIS

       #include <curl/curl.h>

       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE_LARGE,
                                 curl_off_t size);


DESCRIPTION

       If  you  want  to  post  data to the server without having libcurl do a
       strlen() to measure the data size, this option must be used. When  this
       option  is  used  you  can  post  fully binary data, which otherwise is
       likely to fail. If this size  is  set  to  -1,  the  library  will  use
       strlen() to get the size.


DEFAULT

       -1


PROTOCOLS

       HTTP


EXAMPLE

       TODO


AVAILABILITY

       Along with HTTP


RETURN VALUE

       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.


SEE ALSO

       CURLOPT_POSTFIELDS(3), CURLOPT_COPYPOSTFIELDS(3),



libcurl 7.37.0                    17 Jun 2014   CURLOPT_POSTFIELDSIZE_LARGE(3)
CURLOPT_POSTQUOTE(3)       curl_easy_setopt options       CURLOPT_POSTQUOTE(3)




NAME

       CURLOPT_POSTQUOTE - (S)FTP commands to run after the transfer


SYNOPSIS

       #include <curl/curl.h>

       CURLcode   curl_easy_setopt(CURL   *handle,  CURLOPT_POSTQUOTE,  struct
       curl_slist *cmds);


DESCRIPTION

       Pass a pointer to a linked list of FTP or SFTP commands to pass to  the
       server  after  your FTP transfer request. The commands will only be run
       if no error occurred. The linked list should be a fully valid  list  of
       struct  curl_slist  structs  properly  filled  in as described for CUR-
       LOPT_QUOTE(3).

       Disable this operation again by setting a NULL to this option.


DEFAULT

       NULL


PROTOCOLS

       SFTP and FTP


EXAMPLE

       TODO


AVAILABILITY

       If support for the protocols are built-in.


RETURN VALUE

       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
       if not.


SEE ALSO

       CURLOPT_QUOTE(3), CURLOPT_PREQUOTE(3),



libcurl 7.37.0                    17 Jun 2014             CURLOPT_POSTQUOTE(3)
CURLOPT_POSTREDIR(3)       curl_easy_setopt options       CURLOPT_POSTREDIR(3)




NAME

       CURLOPT_POSTREDIR - how to act on a HTTP POST redirect


SYNOPSIS

       #include <curl/curl.h>

       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTREDIR,
                                 long bitmask);


DESCRIPTION

       Pass  a  bitmask  to  control how libcurl acts on redirects after POSTs
       that get a 301, 302 or 303 response back.  A parameter with bit  0  set
       (value CURL_REDIR_POST_301) tells the library to respect RFC2616/10.3.2
       and not convert POST requests into GET requests when  following  a  301
       redirection.   Setting  bit 1 (value CURL_REDIR_POST_302) makes libcurl
       maintain the request method after a 302 redirect whilst setting  bit  2
       (value  CURL_REDIR_POST_303)  makes libcurl maintain the request method
       after a 303 redirect. The value CURL_REDIR_POST_ALL  is  a  convenience
       define that sets all three bits.

       The  non-RFC  behaviour  is  ubiquitous in web browsers, so the library
       does the conversion by default  to  maintain  consistency.  However,  a
       server  may  require  a POST to remain a POST after such a redirection.
       This option is meaningful only when setting  CURLOPT_FOLLOWLOCATION(3).


DEFAULT

       0


PROTOCOLS

       HTTP


EXAMPLE

       TODO


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.


RETURN VALUE

       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
       if not.


SEE ALSO

       CURLOPT_FOLLOWLOCATION(3), CURLOPT_POSTFIELDS(3),



libcurl 7.37.0                    19 Jun 2014             CURLOPT_POSTREDIR(3)

curl 7.37.1 - Generated Sat Aug 23 18:35:56 CDT 2014
© manpagez.com 2000-2018
Individual documents may contain additional copyright information.