GET VS. POST


When working with server-side scripts (as mentioned above), there are two ways to transfer data between the server and Flash: via GET or POST. These two ways of 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 Flash uses to send data 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 wanted to use GET to send my name and e-mail address to a script located on the register.asp page, you'd specify the URL as: http://www.somedomain.com/register.asp?name=jobe&email=jobe@electrotank.com. The question mark preceding the variables tells the script and server that everything that follows comprise variables. Although GET is easier to use than POST, it won't work for every situation because it has a 1,024-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. Because POST doesn't have a character limit, it provides a slightly more versatile way of sending variable data.

graphics/11fig03.gif

We'll return to the topic of GET and POST in the exercise that accompanies the next section, "Using the LoadVars Object."

TIP

Since GET and POST are not always easily interchangeable, most scripts are programmed to accept variables either via GET or POST but usually not via both.




Macromedia Flash MX ActionScripting Advanced. Training from the Source
Macromedia Flash MX ActionScripting: Advanced Training from the Source
ISBN: 0201770229
EAN: 2147483647
Year: 2002
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net