Looking for a way to make sensor data available online from OF. I have something working now with ofxFTP uploading a .dat file on my website everyday but I’d like to have something live, updating sensor data every 5 seconds or so. The data stream would be going on for several months on a computer at home and I’d access the stream in different locations with my laptop once or twice a month for a show.
There you would be sending two GET values to a PHP script. You would have to write a PHP script that receives value1 and value2 and stores them in a text file or to a database. Security can be an issue (if someone starts calling your script sending random data), so you should validate the input and ideally use https instead of http.
The data stored in the server could be later accessed using a web browser, or from another OF application.
In some cases you can also write server side programs in other languages like JavaScript (with nodejs) or Python, but that’s much less common than PHP, which is available in almost every server.
You could also search online for “iot online database api” to find a free database that don’t require any server side programming, but I haven’t tried any of those. Maybe someone can recommend one?
i would like to get data from the web and use it in openframeworks, commands like start or stop, or just numbers.
my big plan is to connect a particle photon to openframeworks, i will let the photon send data to a webhook and i want to retrieve that data with openframeworks and use it there.
is this possible?
@noobCoder it is possible. You either query the web server regularly from OF to find out if there’s new data, or you keep a open connection to the server with something like web sockets, which allows the server to send messages to OF. OSC can also work, for instance if you have a local Raspberry PI on the same network which receives your photon data and sends it to OF.
The exact implementation will depend on many things: OSes, which approach you use, which kind of API the server has (if any), etc.
Just to let you guys know where I am on this, I did the php script thing and it worked very good. Then 5 days later my site got hacked… I still have to figure out that httpS thing…