Hello,
My project use http module to do GET/POST to a https server. Here is the sample code:
void WWW::request(string url, WWWForm f, std::function<void(WWW*)> pOnHttpResponse){
TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded"));
HttpRequest->SetURL(url.c_str());
HttpRequest->SetVerb(TEXT("POST"));
FString fs(f.getPost().c_str());
HttpRequest->SetContentAsString(fs);
HttpRequest->OnProcessRequestComplete().BindLambda([&, pOnHttpResponse, f](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded)
{
if (!bSucceeded) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Request failed"));
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Got something here!"));
}
});
HttpRequest->ProcessRequest();
}
Basically, i want to send a form to the server and get a response back. The code above works flawlessly on PC , no problem whatsoever. When i deploy my game to Android , the request always fail. When i switched the url to something like “http://something.com”, i got a response. Switched it back to my https server, or any https page, and it will fail. I tried the solution posted in this thread : Using Http Module on Android - Multiplayer & Networking - Epic Developer Community Forums , but no luck. My UE4 version is 4.7.6 .
How do i solve this ?