Skip to main content
Inspiring
October 13, 2013
Answered

How to test connection with php file.

  • October 13, 2013
  • 1 reply
  • 637 views

public function processCreate():void {

            var urlVars:URLVariables = new URLVariables();

            

            var urlFileRequest:URLRequest = new URLRequest("php/controlpanel.php");

            

            urlFileRequest.method = URLRequestMethod.POST;

                        

            urlFileRequest.data = urlVars;

           

            var php2Loader:URLLoader = new URLLoader();

            php2Loader.dataFormat = URLLoaderDataFormat.VARIABLES; 

            php2Loader.addEventListener(Event.COMPLETE, showResult);

           

            urlVars.systemCall = "createprofile";

            urlVars.username = username.text;

            urlVars.password = password.text;

           

            

            php2Loader.load(phpFileRequest);

       

        }

This is my function on a .as file. I want send username and password to php to create a new user profile in mySQL.

I just copy/paste this code I don't know harp what am I doing, I want to do something simple, like trace, but to test the connection between flash and the php/controlpanel.php.

Before I go further adding more codes I want to test if 2 files are properly connected, how do I do that, thannk you.

This topic has been closed for replies.
Correct answer Ned Murphy

The first thing you need to do is test using a server that supports php and place that php file on the server.

The next thing you'll need to do is fix the variable name you use to agree with what your code specifies up top...

php2Loader.load(urlFileRequest);

Confirming whether or not the connection worked can be managed with whatever your showResult function does.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
October 13, 2013

The first thing you need to do is test using a server that supports php and place that php file on the server.

The next thing you'll need to do is fix the variable name you use to agree with what your code specifies up top...

php2Loader.load(urlFileRequest);

Confirming whether or not the connection worked can be managed with whatever your showResult function does.

Inspiring
October 13, 2013

Hi, Ned.

After I fixed urlFileRequest, showResult shows properly in the dynamic text box now, thanks a lot.