PDA

View Full Version : POST becoming GET ?



Voetsjoeba
November 14th, 2003, 02:55 PM
Hey everybody,

I'm having some problems using the send method of the LoadVars object. What I'm trying to do is send a variable to PHP which then ouputs it.

The problem is that I can get it to work using the GET method, but not using the POST method. Using the GET method I used this:



lv = new LoadVars();
lv.vari = "Variable sent via Flash";
lv.send("http://127.0.0.1/tut.php","_blank","GET");


And for the PHP I had:



<?
$receive = $_GET['vari'];
echo $receive;
?>


And it worked fine. But it used this URL that displayed the variable so I thought I'd use POST:



lv = new LoadVars();
lv.vari = "Variable sent via Flash";
lv.send("http://127.0.0.1/tut.php","_blank","POST");



<?
$receive = $_POST['vari'];
echo $receive;
?>

This doesn't work. Also, Flash seems to be still using the GET method, because the url it uses is the same as before:

http://127.0.0.1/tut.php?vari=Variable%20sent%20via%20Flash

while the ?vari=... part shouldn't even be there when using POST, should it ? What's going wrong here ?

hamza84
November 14th, 2003, 03:01 PM
thats odd. I used that format for one of my websites and it works fine... can't figure out any typos in ur script. Weird

ahmed
November 14th, 2003, 03:44 PM
Are you running it through the Flash IDE? did you try doing so from a browser? The player in Flash MX had a bug which sent variables through GET even when POST was specified


POST is used when executed from plug-in or ActiveX embedded in the browser. GET is used when executed from a projector, or the flash authoring environment. (This was for Flash 5. Flash MX always uses POST when you send the XML.)[ LINK (http://chattyfig.figleaf.com/flashcoders-wiki/index.php?XML%20Object%20General) ]

Voetsjoeba
November 14th, 2003, 04:10 PM
I was using it from the CTRL+ENTER display. Is that the Flash IDE ? :P I'll try through a browser, thanks Ahmed, some usefull information there =)

ahmed
November 14th, 2003, 04:13 PM
yes, that IS the Flash IDE, or Integrated Development Env., or Program in other words :P

Voetsjoeba
November 14th, 2003, 04:22 PM
Cool, didn't know that, thanks for the info ahmed =)

Jubba
November 18th, 2003, 12:15 PM
Yeah Ahmed knows all about that...