Reading a file online

I need to read a sequence of bytes stored in a basic txt file which can be found at a specific url.
With a local file path I can use SaveFileToArray() function to store the bytes in a uint8 array, how can I do the same with the given file url?

Fact that you can use http urls as files is a extra feature to make things comfitible, but in code they are 2 separate data channels with diffrent APIs.

UE4 has module to talk to HTTP server:

This is entry point:

Create a http request:

I returns request body which you can edit with those functions:

Request is processed asynchronously so it does not lock the thread waiting for response from server, thats why you need to bind event which be called when responce been recived:

Once you set up the request you call ProcessRequest and HTTP module with do the rest:

And once it got reponce it will call function you binded with IHttpReponce argument from which you can read reponce data:

Here you have nice simple example from engine source code how to use it (Note how OnProcessRequestComplete function arguments, your function needs to be exactly the same, only name can be different):

https://github.com/EpicGames/UnrealEngine/blob/a27ad66f0a075f3b74ef8f68a4b2b0da4882425e/Engine/Source/Runtime/Online/HTTP/Private/HttpTests.cpp

If you don’t know how HTTP works (which if you ever worked with PHP and web devlopment you should know) then learn about it because it will be very useful here:

And lastly if you gonna use HTTP module, remember to add “HTTP” in to depency in build scipt same as you do with “AIModule”, otherwise you gonna have linker errors

Hello, Thanks for your description, I’ve a question:
I’m trying to add support for external login for my App (I’m trying to add WeChat QR scan login) It totally use the URL to handle process, I can show the QR code in UE web browser and i can login successfully but the login is totally in that browser, I need to login outside of browser too, do you have any suggestion how i can do that ? (Now i can manually login to my server with username & password with and POST verb)…
Thank you

You know how cookie sessions work right? Somehow you need to catch the session id and use it with HTTP to by sending cookie (first learn how cookies works). Noe here the problem, it seem theren ot really way to get a cookie from web browser widget, you would need to get some session key with diffrent method, liek sending key somehow and catcxh it web browser event and use it later in HTTP. Best sollution would be if you use login without using web browser.