简体   繁体   中英

URLVariables not working in Haxe project

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.

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM