x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UE4 Reference C++ Custom Function Library

So im trying to download a text file and return that file back as an Array but im having troubles since it wants me to refrence my custom function library

 UFUNCTION(Blueprintpure, Category = "DanCode")
         void HttpRequest(FString Link, FString& File);

and my .cpp ,, that value I want exported is the one called Downloaded, I want it exported through my HttRequest Fucntion back to me when I recall it in blueprints but it wants a Refrence to this class.

 void UCustomblueprintfunctionlibrary::HttpRequest(FString Link, FString& File)
 {
     
     FHttpModule * http = &FHttpModule::Get();
     TSharedRef<IHttpRequest> Request = http->CreateRequest();
     Request->OnProcessRequestComplete().BindUObject(this, &UCustomblueprintfunctionlibrary::OnResponseReceived);
     //This is the url on which to process the request
     Request->SetURL("file:///C:/Bitnami/wampstack-5.6.30-1/apache2/htdocs/download.php");
     Request->SetVerb("GET");
     Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
     Request->SetHeader("Content-Type", TEXT("application/json"));
     Request->ProcessRequest();
 }
 void UCustomblueprintfunctionlibrary::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
 {
 
     //Create a pointer to hold the json serialized data
     TSharedPtr<FJsonObject> JsonObject;
 
     //Create a reader pointer to read the json data
     TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
 
     //Deserialize the json data given Reader and the actual object to deserialize
     if (FJsonSerializer::Deserialize(Reader, JsonObject))
     {
         //Get the value of the json object by field name
         int32 recievedInt = JsonObject->GetIntegerField("customInt");
 
         //Output it to the engine
         FString AbsoluteFilePath = "C:/Users/RG STUDIOS/Desktop/DOWNLOADED.txt";
         FString Downloaded = FString::FromInt(recievedInt);
         HttpRequest(Downloaded, Downloaded);
     }

Product Version: UE 4.14
Tags:
more ▼

asked Feb 27 '17 at 03:32 AM in C++ Programming

avatar image

Legacy379
6 2 4 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question