I am having a problem with http Request
My code works perfectly with printing but what i am looking for is to return the value returned from the php code to another function which i couldnt approach
here is my code
FString AHttpActor::MyHttpCall(FString Url)
{
TSharedRef<IHttpRequest> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &AHttpActor::OnResponseReceived);
Request->SetURL(Url);
Request->SetVerb("GET");
Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
Request->SetHeader("Content-Type", TEXT("application/json"));
Request->ProcessRequest();
GEngine->AddOnScreenDebugMessage(1, 2.0f, FColor::Green, value);//prints nothing
return value;
}
/*Response*/
void AHttpActor::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
FString recieved = JsonObject->GetStringField("Brain");
GEngine->AddOnScreenDebugMessage(1, 2.0f, FColor::Green, value);//prints the value
value = recieved;
}
}