Post Sensor Data To Web?
Up to Project Discussion
Hello,
I would like to monitor some sensors from a web page. Is it possible to have data uploaded from the controller to the web periodically? I was thinking of having a PHP page on the web server that could process the data and store it in a database.
Any suggestions would be greatly appreciated.
Thanks,
Ian
Yes - this works great. I have been meaning to provide some sample code but we've done this successfully in several scenarios.
Use the Webclient API on the board to POST and GET to/from your server. http://www.makingthings.com/ref/firmware/html/group__webclient.html
Thank you Liam. I have just received my MAKE controller and can't figure out how to get the POST method working.
I would like to process the post data using PHP and am familiar with form processing but do not know how to handle post data from the controller. Typically I can get the post data with $_GET['tag']; but the posted data from the controller has no tag to "grab" the data with.
The other thing that has me confused is the function call. You specify a path but shouldn't it have a filename at the end of it? Right now it looks like the data will be posted to a folder and I can't quite understand that.
Finally, is there any other setup required to start the communication such as sockets etc?
I am totally lost right now and any help would be wonderful.
Thanks again,
Ian
Hi Ian - a raw HTTP post simply appends data to the end of the HTTP header. I'm not sure what PHP does to stuff values into its $_GET[] array - it may be something more, and there may be some optimizations/mods that could be made to accommodate that. In the meantime, you might see if you can read the raw POST data.
The destination of the call depends completely on how you have your web app set up - the URL routing to what looks like a folder might be to a specific controller in an MVC web framework.
I don't think there's anything else you need to do to set this up on the Make Controller - just point it in the right direction and post away. If you run into anything specific, please let us know.
Powered by
Ploneboard

