Can i get information from a html page into ue4?

So i’d like to create a nice little companion app wrapped in some nice CSS and HTML. I’ve looked at the VaRest plugin but this only seems to deal with php requests. Anyone know if i can do it with VaRest, or do i need to look at it in another way. I basically want to offload the design of the companion app to one of our graphic designers and merely receive messages inside ue4 to change things like materials, camera positions etc.
Anyone done this? Or have any ideas on how best to pursue it.

Many thanks,

Wait - you want to receive HTTP requests from within your Unreal app, or you want to send HTTP request from your Unreal app?

If you want to change things in game baded on HTTP requests then you should use VaRest. VaRest in perticilar works great with output and oyu need to make your server output that.

VaRest is for HTTP communication in blueprints (UE4 has APIs for HTTP build in but it not exposed to blueprints), which is protocol used between website servers and web browser, but in general it is data on-demend protocol and can be elsewhere.

It has nothing to do with php which is server software allowing to manipulate and generate HTTP output on existing running HTTP server.

If you want to display the website then you should use WebBrowser widget

https://docs.unrealengine.com/en-us/Engine/UMG/UserGuide/WidgetTypeReference/WebBrowser

1 Like

I want to receive information in Unreal from a web page. So lets say i have a button on the webpage that when clicked sends a string to unreal, which i can then receive and perform blueprint operations on receipt of the string value. Basically it will be simple stuff at first. switching the camera view for example.

That’s interesting, and you sound like you know your stuff! Thanks. I thought VaRest was the right route but as i’m no expert on these matter, i wasn’t sure if i was heading down the wrong path or not. What i don’t understand is that the VaRest examples all show them connecting to a php file. Can i not call these requests from inside the index.html file? I basically just want to set up a simple test that is a html file with a few buttons where by Unreal will listen for the button being pressed and receive a print string of the message.
Am i right to think this can be done? Also i’m testing this using a simple node.js server looking to a localhost connection on port 8000. Is that why i might be running into problems receiving a message back?
Any help would be seriously appreciated.

Also further down the line i was wanting to look at using VaRest plugin to do API requests to sites like google. I assume that VaRest would be the right approach to achieve this too?

That’s a cool idea. I’ve never thought of using Unreal apps as web servers like that, but I can’t see a reason why it couldn’t be done. I just don’t know how to tell Unreal to listen on HTTP ports for HTTP requests. If it’s not natively supported I’m sure it can be extended through a plugin.

Others on this thread mentioned VaRest but I only knew it could send requests. I didn’t think it could receive them and send back responses.

You could have your webpage javascript write information to some file inside the project folder. Have unreal blueprints read that file as needed. This also looked interesting: