-
-
Notifications
You must be signed in to change notification settings - Fork 11
libcURL.cURLClient.Post
libcURL.cURLClient.Post
Function Post(URL As String, PostFields() As String, WriteTo As Writeable = Nil) As Boolean
Function Post(URL As String, FormData As libcurl.MultipartForm, WriteTo As Writeable = Nil) As Boolean
Function Post(URL As String, FormData As libcurl.MIMEMessage, WriteTo As Writeable = Nil) As Boolean
Function Post(URL As libcURL.URLParser, PostFields() As String, WriteTo As Writeable = Nil) As Boolean
Function Post(URL As libcURL.URLParser, FormData As libcurl.MultipartForm, WriteTo As Writeable = Nil) As Boolean
Function Post(URL As libcURL.URLParser, FormData As libcurl.MIMEMessage, WriteTo As Writeable = Nil) As Boolean
Sub Post(URL As String, PostFields() As String, WriteTo As Writeable = Nil)
Sub Post(URL As String, FormData As libcurl.MultipartForm, WriteTo As Writeable = Nil)
Sub Post(URL As String, FormData As libcurl.MIMEMessage, WriteTo As Writeable = Nil)
Sub Post(URL As libcURL.URLParser, PostFields() As String, WriteTo As Writeable = Nil)
Sub Post(URL As libcURL.URLParser, FormData As libcurl.MultipartForm, WriteTo As Writeable = Nil)
Sub Post(URL As libcURL.URLParser, FormData As libcurl.MIMEMessage, WriteTo As Writeable = Nil)
Name | Type | Comment |
---|---|---|
URL |
String or URLParser
|
The RFC 3986 URI to which the form should be posted. In libcurl 7.62.0 and newer, you may also pass an instance of URLParser. |
PostFields |
String array |
An HTTP form which will be encoded as application/x-www-form-urlencoded . |
WriteTo | Writeable |
Optional. Downloaded data (if any) will be written to this object. If this parameter is Nil then use GetDownloadedData. |
Name | Type | Comment |
---|---|---|
URL |
String or URLParser
|
The RFC 3986 URI to which the form should be posted. In libcurl 7.62.0 and newer, you may also pass an instance of URLParser. |
FormData | MultipartForm |
An HTTP form which will be encoded as multipart/form-data . You may also pass a Dictionary to be converted. |
WriteTo | Writeable |
Optional. Downloaded data (if any) will be written to this object. If this parameter is Nil then use GetDownloadedData. |
Name | Type | Comment |
---|---|---|
URL |
String or URLParser
|
The RFC 3986 URI to which the form should be posted. In libcurl 7.62.0 and newer, you may also pass an instance of URLParser. |
FormData | MIMEMessage |
An HTTP form which will be encoded as multipart/form-data . |
WriteTo | Writeable |
Optional. Downloaded data (if any) will be written to this object. If this parameter is Nil then use GetDownloadedData. |
The synchronous versions of this method return True
on success. Check cURLClient.LastError if this method returns False
.
POST
an HTTP form using either multipart/form-data
or application/x-www-form-urlencoded
.
To encode the form using multipart/form-data
, pass a Dictionary of NAME
:VALUE
pairs comprising HTTP form elements: NAME
is a string containing the form-element name; VALUE
may be a string or a FolderItem. You may also specify a MultipartForm
instance for advanced options.
To encode the form using application/x-www-form-urlencoded
, pass an array of URL-encoded NAME=VALUE
strings comprising HTTP form elements.
If the URL
parameter is empty (""
) then the previous URL is reused; if there is no previous URL then the transfer will fail with error code CURLE_URL_MALFORMAT
(3). If the previous transfer involved any sort of redirection then the "previous URL" is the URL enclosed in the final redirect.
When using HTTP/1.1, libcURL will send a Expect: 100-Continue
header and then wait briefly for the server to respond. This allows HTTP/1.1 servers to reject the operation before the (potentially large) form payload is transferred. Not all servers support this feature, and libcURL will continue normally if no intermediate reply comes from the server. You may disable this feature by deleting the Expect
header.
To POST other kinds of data use the Put() method and override the request method with "POST"
:
Dim curl As New cURLClient
curl.SetRequestMethod("POST")
curl.RequestHeaders.SetHeader("Content-Type", "text/plain") ' set the data type
If Not curl.Put("http://api.example.com", TheDataAsMemoryBlock) Then ' use the Put() method instead of Post()
MsgBox("Error")
End If
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.