Communication with a MYSQL Databse using PHP

I am currently trying to build a online login system, where the user can enter a form with a username and password and login.

To do this, I am using the FHttpModule to send a request to a PHP server to verify it. Except, I’m not sure if it’s possible for PHP to communicate back to the client whether the user information is valid or not.

Basically what I’m trying to ask is how would you go about setting up a two way communication system between the client and the database(MYSQL)? Right now, the client can only send, but not receive. I guess this may be more of a design problem, but I’d like to know how some of you guys got around it. Keep in mind I’d like to avoid direct interaction with the database, if at all possible

UPDATED:
Here is the relevant code:



	TSharedRef<IHttpRequest> req = FHttpModule::Get().CreateRequest();
	req->SetVerb(TEXT("GET"));
	req->SetURL(TEXT("http://localhost/index.php"));
	req->SetHeader("Content-Type", "text/plain");
	req->SetContentAsString(TEXT("?username="+username+"&password="+password));

	req->OnProcessRequestComplete().BindUObject(this, &LoginScreen::CompleteHTTPRequest);

	if (!req->ProcessRequest()) {
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("The request failed"));
	} else {
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("The request was processed"));
	}


The php echos what is needed on the page, and I am attempting to download the page contents in order to retrieve the message. However, for some reason the CompleteHTTPRequest function is not being called.

I’m not really sure what the problem is, as the code is based off an example I saw. Help would be much appreciated.

As a side note, I realize what I’m doing is not secure (GET instead of POST, plain text passwords), but once I have something working I can fix that.

The only thing you need to think about is that at this point, for this login procedure, your instance of UE4 is essentially a headless web client. You can do the same workflow as you would with a PHP server and say, an OAuth client. UE4 also has helpers when it comes to serializing and deserializing from JSON and having your PHP server send responses to the requests.

Really comes down to research. Here are some helpful docs:

Also, what is the definition of your &LoginScreen::CompleteHTTPRequest? And to be honest, you should really be doing this stuff in your own OnlineSubsystem Identity implementation.

At this point I am beginning to think that rolling my own database and server is a bad idea, especially for the kind of connections that will be required. I’m looking into Photon and other third party solutions.

Thanks for your time