Image Uploader Scripting API
|
Network client (libcurl wrapper). More...
Inherits INetworkClient.
Public Member Functions | |
void | addQueryHeader (string name, string value) |
void | addQueryParam (string name, string value) |
void | addQueryParamFile (string name, string fileName, string displayName, string contentType) |
bool | doGet (string url) |
bool | doPost (string data) |
bool | doUpload (string fileName, string data) |
bool | doUploadMultipartData () |
void | enableResponseCodeChecking (bool enable) |
string | errorString () |
double | getCurlInfoDouble (int option) |
int | getCurlInfoInt (int option) |
string | getCurlInfoString (int option) |
int | getCurlResult () |
string | getCurlResultString () |
string | responseBody () |
int | responseCode () |
string | responseHeaderByIndex (int index, string name) |
string | responseHeaderByName (string name) |
int | responseHeaderCount () |
string | responseHeaderText () |
void | setChunkOffset (double offset) |
void | setChunkSize (double size) |
void | setCurlOption (int option, string value) |
void | setCurlOptionInt (int option, long value) |
void | setMaxDownloadSpeed (uint speed) |
void | setMaxUploadSpeed (uint speed) |
void | setMethod (string str) |
void | setOutputFile (string str) |
void | setReferer (string str) |
void | setUrl (string url) |
void | setUserAgent (string userAgentStr) |
string | urlDecode (string str) |
string | urlEncode (string str) |
Network client (libcurl wrapper).
Note: After each completed request, most of the options are set to default values.
In .nut scripts: "nm" is a global instance of NetworkClient
|
override |
Sets the value of the HTTP request header. To delete a header, pass in an empty string. To set an empty value, pass "\n". Example:
|
override |
Adds a parameter to the POST request with the name and value
|
override |
Adds a file parameter to the MULTIPART/DATA POST request.
name | is the name of the request parameter |
fileName | is the physical path to the file |
displayName | is the display name (the name that is transferred to the server does not contain a path), |
contentType | is the mime file type, can be an empty string or obtained using the GetFileMimeType function). The method is similar to the HTML form element - <input type = "file">. |
|
override |
Example 1
Example 2
|
override |
Performs a POST request.
data | - the request body (for example, "param1 = value param2 = value2"). If data is an empty string, the parameters previously set using the addQueryParam() function are used. |
Example 1
Example 2
|
override |
Sending a file or data directly in the body of a POST request
Example 1
Example 2
|
override |
Sends a request to the address set by the function setUrl as parameters and files encoded in the MULTIPART/FORM-DATA format. Similar to sending a form with a file from a web page.
Example
|
override |
Enables HTTP error logging.
|
override |
Returns the error text for the last request executed (for example, "HTTP 404 not found").
|
override |
Get information from curl. curl_easy_getinfo. Numeric values of CURLINFO_* constants you can find here.
|
override |
Returns the response code (for example, 200 means HTTP OK).
|
override |
Returns number of headers in response.
|
override |
Returns all response headers
|
override |
Set the byte offset of current chunk, relative to the beginning of the full file.
|
override |
Sets size of current chunk.
|
override |
Sets the string value for an option of the CURL object. Equivalent to calling the curl_easy_setopt function. Note that option is a number. A list of the numerical values of the option can be found here.
|
override |
Sets the numeric value for an option of the CURL object
|
override |
|
override |
Allows you to manually set the type of request - POST, GET, PUT ...
|
override |
Sets the URL for the next request.
|
override |
|
override |
Percent ecoding, it necessary when preparing a valid GET request.