Here is a great way to send POST data to a Web Server. We will use two objects: a LoadVars object to send and to receive an XML object (in case we expect a return formatted XML document). Use the LoadVars object in Flash is useful for creating run-time properties that will be seen as POST variables for both the ability to specify the delivery method: POST or GET.
First of all we create the LoadVars object that will be used to ship:
1 | LoadVars = new LoadVars ( ) ; var s_lv: LoadVars = new LoadVars (); |
To this we add the POST variables in a very simple:
1 2 | ; s_lv. title = "Hello"; ; s_lv. subtitle = "Hello World"; |
Prepare the object that receives the response from the Web Server (in stdout) - if you just make a PHP echo:
At this point we can do is send:
1 | "http://miodominio.com/miapagina.php" , r_xml , "POST" ) ; s_lv. sendAndLoad ("http://miodominio.com/miapagina.php" r_xml, "POST"); |
The sendAndLoad () method of the LoadVars object is very ultile as it allows you to specify the object return (in this case our XML object r_xml) and the shipping method (in our case POST).
Finally just put on hold:










There are no comments for this post
Leave a comment