Pages: 1 2 3 [4]   Go Down
Author Topic: Arduino ethernet webclient php script and mysql  (Read 44288 times)
0 Members and 2 Guests are viewing this topic.
South Coast UK
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ 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.
Logged

South Coast UK
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I can get data by sending command http://192.168.1.19/?a=getTemp1 from my web browser but how do you do it by .php?

I've tried this:
Code:
<html>
The temperature is <?php echo $_GET["http://192.168.1.19/?a=getTemp1"]; ?>
</html>

The webpage then displays:
Code:
The temperature is

but the temp vale is never displayed.

Has anybody an ideas on the code I require?

Thanks
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46099
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 "http://192.168.1.19/?a=getTemp1", which is clearly not a valued name.

In the GET request, "http://192.168.1.19/?a=getTemp1", 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.
Logged

Pages: 1 2 3 [4]   Go Up
Jump to: