Data form database to esp
Posted: Sat Jan 07, 2017 1:19 pm
Hi
Is there someone who can help me and show me how i can receive data for database to esp, because i need this date in arduino sketch. I can send data to database, and this is my code in php:
and from arduino ide:
And this works fine, but how to receive date?I will be very grateful for help.
Is there someone who can help me and show me how i can receive data for database to esp, because i need this date in arduino sketch. I can send data to database, and this is my code in php:
Code: Select all
<?php
$wartosc1 = $_GET['temperatura'];
$wartosc = $_GET['wilgotnosc'];
$connect = mysqli_connect("localhost","root","szynszyle","food") or die("blad polaczenia z baza danych");
if($wartosc!='')
{
$dodaj=mysqli_query($connect,"INSERT INTO device_values (device_id,temp_level,humidity_level) VALUES ('100','$wartosc1','$wartosc')");
echo "<h1>THE DATA HAS BEEN SEND!!</h1>";
mysqli_close($connect);
}
?>
and from arduino ide:
Code: Select all
String url = "http://localhost/food/conec.php?temperatura="+String(t)+"&wilgotnosc="+String(h);
Serial.print("Wysylam dane na serwer: ");
Serial.println(url);
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + String(adresSerwera) + "\r\n" +
"Connection: close\r\n" +
"Content-Length: 0\r\n" +
"\r\n");
And this works fine, but how to receive date?I will be very grateful for help.