libcURL.MultipartForm.Serialize - charonn0/RB-libcURL GitHub Wiki
libcURL.MultipartForm.Serialize
Method Signatures
Function Serialize() As String
Function Serialize(WriteTo As Writeable) As Boolean
Parameters
Serialize(Writeable)
| Name | Type | Comment |
|---|---|---|
| WriteTo | Writeable |
A serialized representation of the form will be written to this object. Pass Nil to raise the SerializePart event instead. |
Return value
Serialize()
A serialized representation of the form.
Serialize(Writeable)
If True the operation succeeded. Otherwise, check MultipartForm.LastError for details.
Remarks
Serializes the form structure into a multipart/form-data string. The serialized form may be used with other HTTP libraries, including the built-in HTTPSocket. Serialization can be a slow operation, so it should be done sparingly.
Serialized forms can be reconstituted by using the Deserialize method.
Form elements whose value is a reference to a Readable object will only be read when the form is actually about to be sent to the server. As such, these elements will be empty if you call Serialize before the form is sent to a server.
Example
Dim form As New libcURL.MultipartForm
form.AddElement("username", "Bob")
form.AddElement("password", "seekrit")
Dim formdata As String = form.Serialize
After running, the contents of the formdata String will be:
Content-Type: multipart/form-data; boundary=------------------------82a03fc80fa35c1c
--------------------------82a03fc80fa35c1c
Content-Disposition: form-data; name="username"
Bob
--------------------------82a03fc80fa35c1c
Content-Disposition: form-data; name="password"
seekrit
--------------------------82a03fc80fa35c1c--
See also
- curl_formget in the libcURL documentation.