Go Down

Topic: Retrieving sensor values from Arduino UNO via PHP GET (Read 687 times) previous topic - next topic

lpallard

May 10, 2013, 04:01 am Last Edit: May 10, 2013, 04:04 am by lpallard Reason: 1
Hi!  I have tried pretty much everything I could think of, and Google has not been of much help unfortunately..

Basically, I have built an Arduino UNO based Ethernet thermometer and its working GREAT thanks to the valuable help from this community!

Now I'd like to push the project a bit further and monitor the sensor's output.

As it is now, I can access the ethernet thermometer's webpage and see the sensor's readings so I know the Arduino side of the project is working fine.  I can also store values to a MySQL database fine via a PHP script so this is also working fine.  Its getting the values from the Arduino that is puzzling me.  I have tried several php scripts from the internet but none have been working..

My PHP script:

Code: [Select]

<?php
header
('Content-type: text/plain');

$link mysql_connect("localhost""username""password") or die("Cannot login to MySQL server!!: " mysql_error());
mysql_select_db("arduino") or die("Unable to select DB!!");
$query "INSERT INTO temp(temp_string_a, temp_string_b, temp_string_c, temp_string_d, temp_string_e) VALUES ('" $_GET['temp_string_a'] . "', '" $_GET['temp_string_b'] . "','" $_GET['temp_string_c'] . "','" $_GET['temp_string_d'] . "', '" $_GET['temp_string_e'] . "')";$result mysql_query($query) or die("Request failed!!: " mysql_error());

mysql_close($link);
?>



The Arduino sketch (Special Thanks to the devs at code.google.com/p/webduino for their sketch!!!!) is attached to this post because the overall length exceeded the forum's maximum post length


One of the things that worries me (and I think this is pretty normal) is the fact that the PHP code has no mean to retrieve from an ethernet connection...  Nowhere I indicated the device's IP.... I am very useless in PHP programming and in C++ in general so please give me a chance.. ;)

Can anyone help me tie the two ends together and successfully retrieve the sensor's data and store to the MySQL DB?

Thank you!!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy