Setting HTTP/S Form Variables

There are two ways within ASL to control how form variables are submitted with your HTTP/S request. The most common is to use the "form" command to set each variable individually:

form ssn="000-00-0000"
form date="2008-08-13"
form amount="100.00"

Then when you issue an http or https command in your ASL script, the variables will be packaged up appropriately for the protocol and sent with the request. While the most popular way to set form variables, this way has some limitations. It assumes that your form's variable names are also proper ASL variable names. But ASL doesn't allow any special characters in the names, and spaces are not allowed either. To handle these situations, you can use the formdata command which allows you to explicitly control the data that is sent, including its format:

formdata "ssn=000-00-0000&date=2008-08-13&amount=100.00"

You must be careful to construct your form data in a way acceptable to your server. Whatever you put in this string is sent, unaltered, with the HTTP/S request.

Sometimes in building a script, we trace through the interaction with a port sniffer. This allows us to see the entire conversation between the web browser and web server which allows us to craft an ASL script to mimic the behavior as close as possible. A pleasant side effect is that frequently we can just lift the form parameters from the trace. When we can get the parameters this way, we can use the formdata command to set them in our script.