Connecting website variables to UE4

Hi i was wondering if it would be possible to connect a number on a website to ue4 blueprints. E.g when you click on the link below .

These number on the website are changing every second so would it be possible to connect those variables to ue4 blueprints so my float variables in ue4 changes every tick deepening on the numbers on the website.

Many Thanks

You are aware that world population number is just theoretical information based on statistical data on birth and deaths around the world? there no system that actually that monitor this, that this website does is just simulates the data.

In other words garbing this data is pointless (it only creates issues that you don’t really need to deal with) because you can make your game simulate exact same data, learn how to calculate estimated population instead same as that website do, at worse you will need to get birth/date ratio from internet.

If you need any information from internet, first you need to get data for of it in either or XML then in C++ you can use HTTP module to grab it or use VaRest plugin for blueprint but it only supports decoding. Keep in mind that you can not just grab data from website without permission as you will generate extra bandwidth on there server, and doing this on every frame is crazy idea. Google web APIs to search for any good sources. Also general practice is to have server that grabs that data from other server and use your server to grab that data in to your game, one of the reason why it should be done this way is not only bandwidth lifting from original host but also fact that usually those APIs require some keys with use limit and which also should not be distributed to users.

Hi, thanks very much for the reply. I’m aware the statistics on the website i linked are incorrect but i just wanted to give a basic example as to not confuse anyone. What i had in mind was to connect some stock prices to my ue4 project for a personal program and this is why i wanted to call every frame in order to get correct figures every second.

I was planning to do this as a hobby but it seems to be much more complicated than i predicted.

Again thank you for the information :slight_smile:

Http requests that run every 0.1666667th of a second? I wish I had your internet connection!

Old post to reply to but I want to say not to be discouraged about this
You can do it!

But unless you have dedicated socket connection to the web host, you will be requesting the information by stateless HTTP requests, which tend to have a round trip time that is much higher than the amount of time between ticks. You’ll cause a traffic jam on your connection making a request every tick, because the host you’re requesting the information from is not going to be able to respond before you make the next request.

As for how to do it, there is a plugin called VaRest that lets you do HTTP requests in Blueprints, and if you create a C++ object or actor, you can program your own http requestor using standard libraries such as cURL (there may be some even easier to use stuff out there, too).

I would say try the VaRest plugin or similar. It is fairly straightforward if you understand how to use Event dispatchers in Blueprints, and understand how HTTP requests work in general (request to URL, continue running other parts of the program while waiting for response event, handle response event when it comes, and use the data in the response for whatever you want).

has a good point though, where they might not like you spamming their server with very frequent requests. If you can live with every 10 seconds update, they might be okay with that, I don’t know for sure.