Using the %protocol Variable

Top  Previous  Next

 

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 + SSL) Control + data

FTPS (FTP + SSL) Control only

FTPS (FTP + SSL) Data only

FTPS (FTP + Implicit SSL)

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