July 4, 2011, 5:35 p.m.
posted by ivlis
GET versus POST
There are two ways to transfer data between the server and Flash when working with server-side scripts: via GET or via POST. These two techniques for sending variables and their associated values are used in regular HTML pages and in Flash whenever data entered into a form is sent to a server to be processed. (We'll discuss the specific methods in the following exercises.)
When you send variables using GET, you're simply concatenating variable name/value pairs onto the URL itself. For example, if you want to use GET to send my name and email address to a script located on the register.asp page, you'd specify the URL as follows:
The question mark (?) tells the script and server that everything that follows comprises variables. Although GET is easier to use than POST, it won't work for every situation because it has a 1024-character limit.
Now let's take a look at how POST is used. When variable data is sent using POST, that data is contained within the header of the HTTP request, which means you cannot see it being transferred. This gives you an added layer of security because the variables are not easily read. Because POST doesn't have a character limit, it provides a slightly more versatile way of sending variable data.
We'll return to the topic of GET and POST in the exercise that accompanies the next section, "Using the LoadVars Class."
Because GET and POST are not always easily interchangeable, most server-side scripts are programmed to accept variables via either GET or POST, but usually not both.