Storing data from Processing applet via PHP

by heather @ 9:55 am 16 February 2012

Sources:
http://www.learningprocessing.com/tutorials/php/
http://wiki.processing.org/w/Saving_files_to_a_web-server

This ended up being a little tricky, but as long as you have access to a webserver to load the PHP script that parses your data and stores it to an on-server text file, you can run your processing applet from anywhere and just send parameters in via url specified variables.

For example, the string:
http://littlegreencocktail.com/php/loadstrings.php?file=test1&type=save&x=200&y=100
includes variables ‘file’ that is set to ‘test1’, ‘type’ that is set to ‘save’, ‘x’ set to 200, and ‘y’ to 100.

With some editing of the sample code from the first source listed above, my php script now saves “200, 100” to the file test1.txt, adding a new line to the file if it pre-exists, otherwise first creating the file.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2024 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity