curl_easy_setoptΒΆ

curl_easy_setopt sets one or more options for a curl pointer.

error = curl_easy_setopt(curl, oOptions)
error = curl_easy_setopt(curl, optionID, option)

Return Value

errCode is 0, if the data transfer was successful or an error code. The error code description can be received calling curl_easy_strerror.

errCode

Parameters

curl

Is the curl pointer returned by curl_easy_init.

optionID

optionID is the option Id, for example CURLOPT_URL (10023).

option

option is the option value, a string, a number of an object, depending on optionID.

oOptions

oOptions is an option object.

Option Data Type Description
CURLOPT_HTTPHEADER String Vector Extra Header Data.
CURLOPT_HTTPPOST String Vektor

smFormData is a string matrix with two columns or an empty String "".

The first column is the name element and the second column contains the value element.

Example: An HTML page contains the following form:

<form method="POST" action="download.cgi">
   <input type="text" name="email"/>
   <input type="text" name="password"/>
   <input type="submit" name="download" value="Download"/>
</form>

smFormData can be specified as following:

smFormData = ["email", "info@uniplot.de";
              "password", "xxxx";
              "download", "Download"];
CURLOPT_URL String The URL, for example "http://www.uniplot.de".
CURLOPT_WRITEFUNCTION String

UniScript-Callback function name:

my_write_callback(data, user_obj)

data: Is a UniScript string with data.

user_obj: Ein Objekt (obj_create).

def _curl_write_callback(data, user)
{
    user.cnt = user.cnt + 1;
    user.data[user.cnt] = data;
    return 1;  // return 0 to abort transfer
}
CURLOPT_WRITEDATA Object An Object (obj_create) passed as a parameter to the callback function.
CURLOPT_READFUNCTION String UniScript-Read function name.
CURLOPT_READDATA Object An object (obj_create) passed to the callback function.

Example:

The prefix CURLOPT_ can be skipped and all names can be specified in lower case:

oOptions = [. ssl_verifyhost = FALSE,
              timeout = 5 /* sec. */];

A complete list of all options can be found here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html. All options with the data type long, OFF_T values and char* values can be used.

Example

See curl_easy_init.

History

Version Description
R2015.0 New.

id-266065