Platforms to show: All Mac Windows Linux Cross-Platform

Back to CURLSMBS class.

Next items

CURLSMBS.AddMimePart as CURLSMimePartMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 18.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds a new blank mime part.

Returns mime object, so you can set properties.

CURLSMBS.ClearData

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Clears data properties.

Resets OutputData, DebugMessages and Headers.

CURLSMBS.CloseMTDebugOutputFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Closes the debug output file for PerformMT.

Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.

CURLSMBS.CloseMTHeaderOutputFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Closes the header output file for PerformMT.

Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.

CURLSMBS.CloseMTInputFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Closes the input file for PerformMT.

Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.

CURLSMBS.CloseMTOutputFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Closes the output file for PerformMT.

Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.

CURLSMBS.CreateMTDebugOutputFile(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where debug data is written to.

Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

See also:

CURLSMBS.CreateMTDebugOutputFile(Path as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 19.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where debug data is written to.

Returns true on success and false on failure (e.g. permission error).

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

See also:

CURLSMBS.CreateMTHeaderOutputFile(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where header data is written to.

Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

See also:

CURLSMBS.CreateMTHeaderOutputFile(Path as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 19.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where header data is written to.

Returns true on success and false on failure (e.g. permission error).

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

See also:

CURLSMBS.CreateMTOutputFile(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where output data is written to.

Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

You can set CollectOutputData to false in order to disable dat being collected.

See also:

CURLSMBS.CreateMTOutputFile(Path as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 19.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a file where output data is written to.

Returns true on success and false on failure (e.g. permission error).

Must be called before Perform, so we can stream data to the file.
The file is closed automatically when Perform methods finish their work.

You can set CollectOutputData to false in order to disable dat being collected.

See also:

CURLSMBS.FileInfos as CURLSFileInfoMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 15.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries array with file information.

If you use OptionWildcard, you find after the transfer all CURLSFileInfoMBS objects for all the files/folders found.

For MBS Plugin 19.0 or newer you can alternatively run a custom request "MLSD" and than get file infos, too.

CURLSMBS.FinishMime

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 18.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Finishes mime data.
Example
Var c as new CURLSMBS

// add mime
Var p as CURLSMimePartMBS = c.AddMimePart

p.name = "Text"
p.FileName = "test.txt"
p.MimeType = "text/plain"
p.DataString = "Hello World"

c.FinishMime
// now you can send...

Please call AddMimePart for each part you like to add and than finally FinishMime before calling perform.

CURLSMBS.FormAdd(FormOption1 as Integer, Text1 as string, FormOption2 as Integer, FormOptions() as Integer, Texts() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 9.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Add a section to a multipart/formdata HTTP POST.
Example
Var c as new CURLSMBS
Var file1 as string = "my-face.jpg"
Var file2 as string = "your-face.jpg"
Var formOptions(-1) as Integer
Var formValues(-1) as string

const CURLFORM_COPYNAME = 1
const CURLFORM_ARRAY = 8
const CURLFORM_FILE = 10

'/* Add two file section using CURLFORM_ARRAY */
formOptions.Append CURLFORM_FILE
formValues.append file1
formOptions.Append CURLFORM_FILE
formValues.append file2

'/* no option needed for the end marker */
c.FormAdd CURLFORM_COPYNAME, "pictures", CURLFORM_ARRAY, formOptions, formValues

Lasterror is set.
See other FormAdd methods for details.

See also:

CURLSMBS.FormAdd(FormOption1 as Integer, Text1 as string, FormOption2 as Integer, Text2 as string, FormOption3 as Integer, Text3 as string, FormOption4 as Integer, Number4 as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 9.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Add a section to a multipart/formdata HTTP POST.

Several FormAdd methods are there. Send a request to support if you need another parameter combination.

Lasterror is set.

FormAdd() is used to append sections when building a multipart/formdata HTTP POST (sometimes referred to as rfc1867-style posts). Append one section at a time until you've added all the sections you want included and then you call FormFinish.

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

First, there are some basics you need to understand about multipart/formdata posts. Each part consists of at least a NAME and a CONTENTS part. If the part is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME. Below, we'll discuss what options you use to set these properties in the parts you want to add to your post.

The options listed first are for making normal parts. The options from CURLFORM_FILE through CURLFORM_BUFFERLENGTH are for file upload parts.

CURLFORM_COPYNAME:
followed by a string which provides the name of this part. libCURL copies the string so your application doesn't need to keep it around after this function call. If the name isn't null terminated, or if you'd like it to contain zero bytes, you must set its length with CURLFORM_NAMELENGTH.

CURLFORM_PTRNAME:
followed by a string which provides the name of this part. libCURL will use the string and refer to the data in your application, so you must make sure it remains until CURL no longer needs it. If the name isn't null terminated, or if you'd like it to contain zero bytes, you must set its length with CURLFORM_NAMELENGTH.

CURLFORM_COPYCONTENTS:
followed by a string to the contents of this part, the actual data to send away. libCURL copies the provided data, so your application doesn't need to keep it around after this function call. If the data isn't null terminated, or if you'd like it to contain zero bytes, you must set the length of the name with CURLFORM_CONTENTSLENGTH.

CURLFORM_PTRCONTENTS:
followed by a string to the contents of this part, the actual data to send away. libCURL will use the string and refer to the data in your application, so you must make sure it remains until CURL no longer needs it. If the data isn't null terminated, or if you'd like it to contain zero bytes, you must set its length with CURLFORM_CONTENTSLENGTH.

CURLFORM_CONTENTSLENGTH:
followed by a long giving the length of the contents.

CURLFORM_FILECONTENT:
followed by a filename, causes that file to be read and its contents used as data in this part. This part does not automatically become a file upload part simply because its data was read from a file.

CURLFORM_FILE:
followed by a filename, makes this part a file upload part. It sets the filename field to the basename of the provided filename, it reads the contents of the file and passes them as data and sets the content-type if the given file match one of the internally known file extensions. For CURLFORM_FILE the user may send one or more files in one part by providing multiple CURLFORM_FILE arguments each followed by the filename (and each CURLFORM_FILE is allowed to have a CURLFORM_CONTENTTYPE).

CURLFORM_CONTENTTYPE:
is used in combination with CURLFORM_FILE. Followed a string which provides the content-type for this part, possibly instead of an internally chosen one.

CURLFORM_FILENAME:
is used in combination with CURLFORM_FILE. Followed a string, it tells libCURL to use the given string as the filename in the file upload part instead of the actual file name.

CURLFORM_BUFFER:
is used for custom file upload parts without use of CURLFORM_FILE. It tells libCURL that the file contents are already present in a buffer. The parameter is a string which provides the filename field in the content header.

CURLFORM_BUFFERPTR:
is used in combination with CURLFORM_BUFFER. The parameter is the string to be uploaded. You must also use CURLFORM_BUFFERLENGTH to set the number of bytes in the buffer. Keep the buffer variable alive till the upload is finished.

CURLFORM_BUFFERLENGTH:
is used in combination with CURLFORM_BUFFER. The parameter is a long which gives the length of the buffer.

CURLFORM_ARRAY:
Another possibility to send options to CURL_formadd() is the CURLFORM_ARRAY option, that passes an Integer Array and a String Array defining its value. Each element in the form is constructed using the option from the integer array and the value from the string array. All available options can be used in an array, except the CURLFORM_ARRAY option itself!

CURLFORM_CONTENTHEADER:
specifies extra headers for the form POST section. This takes a CURL_slist prepared in the usual way using CURL_slist_append and appends the list of headers to those libCURL automatically generates. The list must exist while the POST occurs, if you free it before the post completes you may experience problems.

PS: CURLFORM_FILE does not work in all CURL versions on all platforms due to a bug with integer numbers.

See also:

CURLSMBS.FormAddField(fieldName as String, fieldValue as String, ContentType as String = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Add a section to a multipart/formdata HTTP POST.
Example
Var d as new CURLSMBS
d.FormAddField("company", "Test, Inc.")

For fieldName and ContentType, we use UTF8 always. For fieldValue, we pass through whatever is in the string, so please make sure encoding is working.
ContentType is optional.

Please call FormFinish method later!

CURLSMBS.FormAddFile(fieldName as String, fileName as String, fileContent as string, ContentType as String = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Add a section to a multipart/formdata HTTP POST.
Example
// read content of some file
Var file as folderitem = specialFolder.desktop.Child("test.txt")
Var b as BinaryStream = binarystream.Open(file)
Var FileContent as String = b.read(b.length)

// init some curl object
Var d as new CURLSMBS

// add the file as part of a form
d.FormAddFile("FileAttachment", "test.txt", FileContent, "text/plain")

// later
d.FormFinish

For fieldName, fileName and ContentType, we use UTF8 always. For fieldValue, we pass through whatever is in the string, so please make sure encoding is working.

Filename is ignored, if empty.
ContentType is optional.

Please call FormFinish method later!

CURLSMBS.FormClear

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 19.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Clears current form data.

You usually don't need to call this as Perform clears form data when transfer is done.

CURLSMBS.FormData as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 17.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries current form data.

This is more for debugging as it builds form data as if we would send it.

CURLSMBS.FormFinish

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 9.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Finishes constructing a form.
Example
Var c as new CURLSMBS
Var namebuffer as string = "name buffer"
Var namelength as Integer = lenb(namebuffer)
Var buffer as string = "test buffer"
Var htmlbuffer as string = "<HTML>test buffer</HTML>"
Var htmlbufferlength as Integer = lenb(htmlbuffer)
Var file1 as string = "my-face.jpg"
Var file2 as string = "your-face.jpg"
Var formOptions(-1) as Integer
Var formValues(-1) as string
Var recordbuffer as string = "record buffer"
Var recordlength as Integer = lenb(recordbuffer)

const CURLFORM_NOTHING = 0
const CURLFORM_COPYNAME = 1
const CURLFORM_PTRNAME = 2
const CURLFORM_NAMELENGTH = 3
const CURLFORM_COPYCONTENTS = 4
const CURLFORM_PTRCONTENTS = 5
const CURLFORM_CONTENTSLENGTH = 6
const CURLFORM_FILECONTENT = 7
const CURLFORM_ARRAY = 8
const CURLFORM_FILE = 10
const CURLFORM_BUFFER = 11
const CURLFORM_BUFFERPTR = 12
const CURLFORM_BUFFERLENGTH = 13
const CURLFORM_CONTENTTYPE = 14
const CURLFORM_CONTENTHEADER = 15
const CURLFORM_FILENAME = 16

'/* Add simple name/content section */

c.FormAdd CURLFORM_COPYNAME, "name", CURLFORM_COPYCONTENTS, "content"

'
'/* Add simple name/content/contenttype section */

c.FormAdd CURLFORM_COPYNAME, "htmlcode", CURLFORM_COPYCONTENTS, "<HTML></HTML>",CURLFORM_CONTENTTYPE,"text/html"

'/* Add name/ptrcontent section */
c.FormAdd CURLFORM_COPYNAME, "name_for_ptrcontent", CURLFORM_PTRCONTENTS, buffer

'/* Add ptrname/ptrcontent section */
c.FormAdd CURLFORM_PTRNAME, namebuffer, CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH, namelength


'/* Add name/ptrcontent/contenttype section */
c.FormAdd CURLFORM_COPYNAME, "html_code_with_hole", CURLFORM_PTRCONTENTS, htmlbuffer, CURLFORM_CONTENTSLENGTH, htmlbufferlength, CURLFORM_CONTENTTYPE, "text/html"

'/* Add simple file section */
c.FormAdd CURLFORM_COPYNAME, "picture", CURLFORM_FILE, "my-face.jpg"

'/* Add file/contenttype section */
c.FormAdd CURLFORM_COPYNAME, "picture",CURLFORM_FILE, "my-face.jpg",CURLFORM_CONTENTTYPE, "image/jpeg"

'/* Add two file section */
c.FormAdd CURLFORM_COPYNAME, "pictures",CURLFORM_FILE, "my-face.jpg",CURLFORM_FILE, "your-face.jpg"

'/* Add two file section using CURLFORM_ARRAY */
formOptions.Append CURLFORM_FILE
formValues.append file1
formOptions.Append CURLFORM_FILE
formValues.append file2

'/* Add a buffer to upload */
c.FormAdd CURLFORM_COPYNAME, "name", CURLFORM_BUFFER, "data", CURLFORM_BUFFERPTR, recordbuffer, CURLFORM_BUFFERLENGTH, recordlength

'/* no option needed for the end marker */
c.FormAdd CURLFORM_COPYNAME, "pictures", CURLFORM_ARRAY, formOptions, formValues

'/* Add the content of a file as a normal post text value */
c.FormAdd CURLFORM_COPYNAME, "filecontent", CURLFORM_FILECONTENT, ".bashrc"
'/* Set the form info */

c.FormFinish

Lasterror is set.
The form is assigned to the HTTPPost property.

CURLSMBS.GetInfoActiveSocket as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 18.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Receive the active socket used by this curl session.

If the socket is no longer valid, -1 is returned. When you finish working with the socket, the Destructor closes the socket and cleanup other resources associated with the handle. This is typically used in combination with OptionConnectOnly.

This option was added as a replacement for GetInfoLastSocket since that one isn't working on all platforms.

CURLSMBS.GetInfoAppConnectTime as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 15.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The time stamp when app connected.

CURLSMBS.GetInfoCAInfo as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 22.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries default CAInfo value.

CURLSMBS.GetInfoCAPath as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 22.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries default CAPath value.

CURLSMBS.GetInfoCertInfo as CURLSListMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 15.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries information on the certificate chain.
Example
Var c as new CURLSMBS

// do some transfer
c.OptionURL = "https://www.mbsplugins.de/"
c.OptionCertInfo = true
Var e as Integer = c.perform

// query certificate info
Var lists() as CURLSListMBS = c.GetInfoCertInfo

for each l as CURLSListMBS in lists
MsgBox Join(l, EndOfLine)
next

MsgBox c.DebugMessages

Please set OptionCertInfo first.

CURLSMBS.GetInfoConditionUnmet as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CURL MBS CURL Plugin 15.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Return if the time condition prevented the document to get transferred.

Next items

The items on this page are in the following plugins: MBS CURL Plugin.


The biggest plugin in space...