Reputation: 199
how are you doing? I hope fine.
So I'm trying to send an urlRequest and I can't pass the parameters by url so I'm trying to use the URLVariable, but no matter what I try my php always get null.
var request:URLRequest = new URLRequest(SITE_DOMAIN + "/check_login.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.login = emailInput.text;
variables.password = senhaInput.text;
variables.gotogame = "BURACO";
Reflect.setField(variables, "login", emailInput.text);
Reflect.setField(variables, "password", senhaInput.text);
Reflect.setField(variables, "gotogame", "BURACO");
request.data = variables;
request.method = URLRequestMethod.POST;
openfl.Lib.getURL(request);
As you guys can see I'm trying to set the variables in two ways but neither of they are working and I kind of don't know what to do anymore, please help.
Upvotes: 1
Views: 264
Reputation: 836
Ive used this without problems:
var request:Http = new Http(SERVER + "actions/layout-builder?random=" + Math.random());
request.addParameter("action", "retrieve");
request.addParameter("layoutId", layoutId);
request.onError = function(msg) {
showSimplePopup("Problem loading layout:\n\n" + msg);
}
request.onStatus = function(status:Int) {
}
request.onData = function(response) {
response = StringTools.replace(response, "\r\n", "\n");
layoutCode.text = response;
}
request.request(false);
Upvotes: 3