Lasso Soft Inc. > Home

[ curl_easy_setopt ]


[curl_easy_setopt] is used together with the [curlopt_*] methods. They are all used for the same purpose – to set different options for the curl operation.

For more information, look at the respective [curlopt_] method.

[curl_easy_setopt] sets options for an operation performed using a [curltoken]. It is used in conjunction with a method that starts with curlopt_.

[curl_easy_setopt] is used to tell libcurl how to behave. By using the appropriate options to [curl->set], you can change libcurl's behavior. All options are set with the option followed by a parameter. That parameter can be an integer, a string, an array, a byte variable or just null]. The type of the value depends on what the specific option expects. You can only set one option in each function call. A typical application uses many calls to [curl_easy_setopt] in the setup phase.

Options set with this function call are valid for all forthcoming transfers performed using this [curltoken] variable. The options are not in any way reset between transfers, so if you want subsequent transfers with different options, you must change them between the transfers. You can optionally reset all options back to internal default with [curl_easy_reset].

The [curltoken] is the return value from a [curl_easy_init] or [curl_easy_duphandle] call.

  • Syntax
curl_easy_setopt('curltoken', 'curlopt_option', 'string value')
curl_easy_setopt('curltoken', 'curlopt_option', 'integer value')
curl_easy_setopt('curltoken', 'curlopt_option', 'null value')
curl_easy_setopt('curltoken', 'curlopt_option', 'array value')
curl_easy_setopt('curltoken', 'curlopt_option', 'bytes value')
  • Intermediate

To obtain a list of only file and directory names from a FTP server


local(ctoken, err, data, headerBytes = bytes, bodyBytes = bytes, ready = false)

#ctoken = curl_easy_init
#err = curl_easy_setopt(#ctoken, curlopt_url, "")
#err = curl_easy_setopt(#ctoken, curlopt_ftplistonly, 1)
while(!#ready) => {
     #data = curl_multi_perform(#ctoken)
     #data->second->isa(::bytes) ? #headerBytes->append(#data->second)
     #data->last->isa(::bytes) ? #bodyBytes->append(#data->last)
     #ready = !#data->first
     !#ready ? sleep(10)




Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft