Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.



Note: Make sure you really need to do a POST. If you are simply uploading a file it may be simpler to use the SENDFILE command (which uses the HTTP verb PUT instead of POST).

Note: This process is a little more complicated if you are using Robo-FTP v3.6. If you are using v3.6, see Sample Script #16.

As of v3.6.0 and later, Robo-FTP supports automating communication via HTTP and HTTPS.

One of the more complicated scenarios to automate is the process of communicating interactively with a web site and uploading data via a web form.

HTTP web forms come in 2 basic varieties:


This is the default type of form. It can be submitted using either an HTTP GET or an HTTP POST.

Submit via GET

This type is less common and is not the focus of this sample. Automating this type of form is very easy. You simply need to construct a url of the form:

This can be accomplished with a simple three-line Robo-FTP script:

 FTPLOGON "" /servertype=HTTP
 FTPCD "subdir"
 RCVFILE "script.asp?field1=value1&field2=value2" /as "localfilename.html"

This type of form can only be used for submitting ASCII characters.

Submit via POST

This is the most common type of form submission and is also used to submit ASCII characters in field=value pairs as above. The only difference is instead of appending the form data to the url, the data is added to the body of the POST.

The sample script below demonstrates how to submit this type of form.


This type must be explicitly specified in the <form> tag's enctype attribute like this:

 <form action="" method="post" enctype="multipart/form-data">

This type of form submits data via POST as described above, but can also include a file upload. This is the only type of form that can cover the entire ISO10646 character set.

Uploading a file via this type of form is defined in RFC 2388.

The sample script below demonstrates how to submit this type of form.

The fields, values, and URL used in the script below are examples and will need to be replaced with whatever fields, values, and URL the system you are trying to submit to requires.

  1  SET %field1 = "field1 value"
  2  SET %field2 = "field2 value"
  3  SET %filename = "C:\files\" 
  6  PREPAREPOST /contenttype="multipart/form-data"
  7  ;; you may be able to use /contenttype="application/x-www-form-urlencoded" if you are not uploading a file
  8  postvalue "field1" %field1
  9  postvalue "field2" %field2
 10  postvalue "userfile" %filename /file /contenttype="application/zip"
 11  ;; Leave above line out if you are not posting a file
 12  HTTPPOST "/poster.asp" "" %postresult /outtype=string /intype=prepared 

Browse complete list of scripts