[question] i need advice for web based project

Hello !
first sorry my english i’m french.

So i have a question, i’m doing a project with my fez panda II that use the web.

The fez will get some value of port and i would like to publish it on a web site, and record it in a mysql database.

so i made a server in my local network that have the mysql.

I try two different solution :

first with the webserver in the codeshare but i can’t use php and mysql so i send a file with the value to my server.

and the second put all the html file in my server and at each connexion ask a .xml to the fez with all the value. moreover the fez send each time a state of port change the .xml to record it in mysql.

the both work but i would like to know how you ( the profesionnal :smiley: ) will do.

To resume it’s not a question about how to code it but what solution can i use to make it the faster as i can.

Thank for reading and i hope that you understand what i say :wink:

Hi Spoko,

I’m not sure I really get your approach, but here’s how I would approach this.

You have a data source (Fez) that you want to store that data into a target (MySQL on another box - might help to explain what other capabilities that platform has).

You could approach it a few ways.

You could initiate the transfer from Fez. To do this you could expose a REST service on your DB host that you did a POST to, and that then wrote the data into the DB. Or you could do it as you have, create a file, read file contents, push to DB - given the choice, I would approach it through the REST option.

You could initiate the transfer from the target DB server. To do this you could expose a REST service on the Fez that you did a GET to, that then wrote the data to the DB. This way, the Fez just collects the data it needs and the DB only gets populated when the data is pulled from the server.

Personally, I like the idea of using a “dumb” responder, so the Fez node only exposes a REST service and responds with your XML response, and assuming a Linux box you might use something like python and a scheduled job to read the data and push to the DB.

hope those thoughts help.

You have a web server that can not execute PHP? If you have controll over this, I would put apache2 with mod_php5 on there, so you can execute a PHP script. Communication times would be faster as you would need to send no more data than the URL request. The PHP script would parse the requested url, and grab any environment variables for you, from there you would add this value to MySQL using the built-in SQL API. When it’s all said and done, your PHP script would be no more than 15 lines, and this is how you would add the value and data

www.somewebsite.com/?someVar=someValue