actionscript 3 - Undefined variable from PHP to AS3 -


i need take variables php as3, not working.

as3 code:

var urlloader:urlloader = new urlloader; var urlrequest:urlrequest = new urlrequest("link.php"); var urlvariables:urlvariables = new urlvariables;  urlloader.dataformat = urlloaderdataformat.variables; urlrequest.method = urlrequestmethod.post; urlrequest.data = urlvariables; urlloader.addeventlistener(event.complete, urlcompleted); urlloader.load(urlrequest);  function urlcompleted(event:event):void{     var urlloaderok:urlloader = urlloader(event.target);     urlloaderok.dataformat = urlloaderdataformat.variables;     trace(urlloaderok.data.resultvar); } 

and simple php code:

<?php print "resultvar=okay"; ?> 

i'm getting "undefined" result.

however, if try

trace(urlloaderok.data);  

like this, i'm getting result

%3c%3fphp%0d%0aprint%20%22resultvar=okay%22%3b%0d%0a%3f%3e 

your php code isn't interpreted php, resulting in whole files content returned (try url decode data string), of course isn't valid.

so, check what's wrong server, maybe doesn't support php, maybe php disabled, maybe .php extension isn't registered (that pretty weird though), maybe you're not testing on server @ all, in local filesystem, etc...


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -