Xojo Developer Conference
Join us from 25th to 27th April 2018 in Denver.

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

CURLNMBS.ClearData
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 12.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Clears data properties.
Notes: Resets OutputData, DebugData and HeaderData.
CURLNMBS.CloseMTDebugOutputFile
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Closes the debug output file for PerformMT.
Notes:
Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CloseMTHeaderOutputFile
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Closes the header output file for PerformMT.
Notes:
Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CloseMTInputFile
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Closes the input file for PerformMT.
Notes:
Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CloseMTOutputFile
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Closes the output file for PerformMT.
Notes:
Call after PerformMT finished.
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CreateMTDebugOutputFile(file as folderitem) as boolean
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Creates a file where debug data is written to.
Notes:
Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CreateMTHeaderOutputFile(file as folderitem) as boolean
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Creates a file where header data is written to.
Notes:
Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.CreateMTOutputFile(file as folderitem) as boolean
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 11.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Creates a file where output data is written to.
Notes:
Returns true on success and false on failure (e.g. permission error).
With 15.2 version of plugin, this also works with Perform.
CURLNMBS.FileInfos as CURLNFileInfoMBS()
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Queries array with file information.
Notes: If you use OptionWildcard, you find after the transfer all CURLNFileInfoMBS objects for all the files/folders found.
CURLNMBS.FormAdd(FormOption1 as Integer, Text1 as string, FormOption2 as Integer, FormOptions() as Integer, Texts() as string)
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Add a section to a multipart/formdata HTTP POST.
Example:
dim c as new CURLNMBS
dim file1 as string = "my-face.jpg"
dim file2 as string = "your-face.jpg"
dim formOptions(-1) as Integer
dim 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
Notes:
Lasterror is set.
See other FormAdd methods for details.

See also:

CURLNMBS.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)
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Add a section to a multipart/formdata HTTP POST.
Notes:
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:

CURLNMBS.FormFinish
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Finishes constructing a form.
Example:
dim c as new CURLNMBS
dim namebuffer as string = "name buffer"
dim namelength as Integer = lenb(namebuffer)
dim buffer as string = "test buffer"
dim htmlbuffer as string = "<HTML>test buffer</HTML>"
dim htmlbufferlength as Integer = lenb(htmlbuffer)
dim file1 as string = "my-face.jpg"
dim file2 as string = "your-face.jpg"
dim formOptions(-1) as Integer
dim formValues(-1) as string
dim recordbuffer as string = "record buffer"
dim 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
Notes:
Lasterror is set.
The form is assigned to the HTTPPost property.
CURLNMBS.GetInfoAppConnectTime as Double
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The time stamp when app connected.
CURLNMBS.GetInfoCertInfo as CURLNListMBS()
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Queries information on the certificate chain.
Example:
dim c as new CURLNMBS

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

// query certificate info
dim lists() as CURLNListMBS = c.GetInfoCertInfo

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

MsgBox c.DebugData
CURLNMBS.GetInfoConditionUnmet as Integer
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Return if the time condition prevented the document to get transferred.
CURLNMBS.GetInfoConnectTime as Double
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.
Notes: The Lasterror property is set. 0 for success.
CURLNMBS.GetInfoContentLengthDownload as Double
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The content-length of the download.
Notes:
The Lasterror property is set. 0 for success.
This is the value read from the Content-Length: field.
CURLNMBS.GetInfoContentLengthUpload as Double
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The specified size of the upload.
Notes: The Lasterror property is set. 0 for success.
CURLNMBS.GetInfoContentType as string
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The content-type of the downloaded object.
Notes:
The Lasterror property is set. 0 for success.
This is the value read from the Content-Type: field. If you get "", it means that the server didn't send a valid Content-Type header or that the protocol used doesn't support this.
CURLNMBS.GetInfoCookieList as CURLNListMBS
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: A linked-list of all cookies CURL knows (expired ones, too).
Notes:
The Lasterror property is set. 0 for success.
If there are no cookies (cookies for the handle have not been enabled or simply none have been received) the result is nil.
CURLNMBS.GetInfoEffectiveURL as string
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The last used effective URL.
Notes: The Lasterror property is set. 0 for success.
CURLNMBS.GetInfoFileTime as Integer
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: the remote time of the retrieved document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone).
Example:
// init CURL with options
dim d as new CURLNMBS
d.OptionFileTime = true
d.OptionURL = "http://www.monkeybreadsoftware.de/images/mbs.jpg"

// run query
dim e as Integer = d.Perform

// calculate date object
dim da as new date(1970,1,1,0,0,0)
da.TotalSeconds = da.TotalSeconds + d.GetInfoFileTime

// show date
ResultText.text=str(d.GetInfoFileTime)+" "+da.ShortDate+" "+da.ShortTime
Notes:
The Lasterror property is set. 0 for success.
If you get -1, it can be because of many reasons (unknown, the server hides it or the server doesn't support the command that tells document time etc) and the time of the document is unknown. Note that you must tell the server to collect this information before the transfer is made, by using the OptionFileTime option or you will unconditionally get a -1 back. (Added in 7.5)
CURLNMBS.GetInfoFTPEntryPath as string
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 15.2, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: Returns a string holding the path of the entry path.
Notes:
That is the initial path libCURL ended up in when logging on to the remote FTP server.
Empty string if unknown.
CURLNMBS.GetInfoHeaderSize as Integer
method, CURL, MBS CURL Plugin (CURLN), class CURLNMBS,
Plugin version: 9.8, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: The total size of all the headers received.
Notes: The Lasterror property is set. 0 for success.

Next items

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




Links
MBS Xojo Plugins