Using the %protocol Variable
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Internal Script Variables > Using the %protocol Variable |
The value of the %protocol variable is useful when developing automation scripts with protocol-dependant behavior. For example, you could use this variable together with the IFSTRCMP function to write a script that requires a specific type of connection or one that only works for secure connections.
Possible values for %protocol are:
FTP
FTPS (FTP + TLS) Control + data
FTPS (FTP + TLS) Control only
FTPS (FTP + TLS) Data only
FTPS (FTP + Implicit TLS)
SFTP (FTP + SSH)
HTTP
HTTPS
Consider the following example where a web form is used for HTTP and HTTPS connections and the SENDFILE command is used for other types of connections:
IFSUBSTR %protocol "HTTP" GOTO UseWebForm
SENDFILE "data.zip"
GOTO done
:UseWebForm
PREPAREPOST /contenttype="multipart/form-data"
POSTVALUE "username" "John"
POSTVALUE "password" "$3Kr!7"
POSTVALUE "datafile" "data.zip" /file /contenttype="application/zip"
HTTPPOST "/rootdir/example.php" "" "ServerResponse.txt" /intype=prepared
:done
RETURN
Related command(s): FTPLOGON, IFSTRCMP
See also: Internal Script Variables