Go Down

Topic: Arduino ethernet webclient php script and mysql (Read 105481 times) previous topic - next topic


@ vinhtvu2. Sorry I haven't been back to this post for a while other matters have cropped up. Your work looks very interesting I'll be back soon.



I can get data by sending command from my web browser but how do you do it by .php?

I've tried this:
Code: [Select]
The temperature is <?php echo $_GET[""]; ?>

The webpage then displays:
Code: [Select]
The temperature is

but the temp vale is never displayed.

Has anybody an ideas on the code I require?



In PHP, $_GET is a variable (an array of name/value pairs, to be exact) that is valued when a GET request of a php script is made. It is not used the way you are trying to.

The way you are trying to use it, the script is trying to find the value that goes with the name "", which is clearly not a valued name.

In the GET request, "", the name of the script to execute is supposed to go between the kast slash and the question mark. If the script is a php script, the $_GET variable will be populated with the names in front of the equal signs, using the values that follow the equal signs. In your case, you would be able to get the value getTemp1 that goes with the name a.

Clearly, there is some issue with what you are trying to do. The Arduino appears to be functioning as a server, so what php has to do with the output from the Arduino is not clear.
The art of getting good answers lies in asking good questions.

Go Up