We are trying to send POST data from Flash to a PHP script, but it’s not working.
loadVariables(URLstring, "_root", "GET"); // this works when reading $_GET from PHP
loadVariables(URLstring, "_root", "POST"); // this doesn't work when reading $_POST from PHP
using the LoadVars() object is the newer and better way of doing this.
var sendInfo = new LoadVars();
//Load up all the variables you want to POST
sendInfo.myVar = "some string or something";
sendInfo.myOtherVar = "some other string or something";
sendInfo.myNumberVar = 22;
sendInfo.send("script.php", "_self","POST");
then you can access myVar, myOtherVar and myNumberVar as post variables in the file addressed by send()
try this instead. this will prevent the browser from actually going to the post page. I dont see why the data would still be GET…
var sendInfo = new LoadVars();
//Load up all the variables you want to POST
sendInfo.myVar = "some string or something";
sendInfo.myOtherVar = "some other string or something";
sendInfo.myNumberVar = 22;
sendInfo.sendAndLoad("script.php", sendInfo, "POST");
Ya, we can’t figure it out either. Even Safari’s activity window shows the URL with the query-string attached. It’s like the “POST” parameter doesn’t work at all.
So, there are 3 people using 3 different PCs saying that it works. I think that it is a problem on Mac, try it out on a PC Peter. Then you can holler at the MM forums & demand why its died up on poor ole Mac.
I still think that is so weird…
have you tried IE and Firefox on MAC to see if its any different?
after that, I would make a very simple swf that just posts some data and see if that works… maybe you have some code in your project that is somehow messing you up…
Well, then we just disagree. ASP has Request.QueryString and Request.Form - same separation as far as I’m concerned. The point is, one should never accept GET (query-string) data as though it came through a POST request.
I agree knowledge of where data is coming from is essential. However sometimes in order to make things cross-browser compliant to include browsers such as Safari, one must make certain sacrifices. If one is concerned enough about where data has come from, one might think about using a server confirguration to only allow requests to one’s page from certain other pages in the same subdomain.