Saving to mysql datase
Posted: Fri Jan 19, 2018 3:59 pm
i'm trying to send data to a mysql database. I have written the php script to store data. Works well. However sending from my wemos r1 d1 doesn't seem to work. I have put:
void loop() {
printWifiStatus();
// Connect to the server (your computer or web page)
if (client.connect(server, 80)) {
Serial.println("--> connection ok\n");
Serial.println("1000");
client.print("GET /write_met.php?"); // This is the get request
client.print("temperature="); // This is the temperature
client.print("100"); // And this is what we did in the testing section above. We are making a GET request just like we would from our browser but now with live data from the sensor
client.print("&leafwetness=");
client.print("100");
client.println(" HTTP/1.1"); // Part of the GET request
client.print( "Host: " );
client.println(server);
client.println("Connection: close"); // Part of the GET request telling the server that we are over transmitting the message
client.println(); // Empty line
client.println(); // Empty line
client.stop(); // Closing connection to server
Serial.println("--> finished transmission\n");
Anything obvious with what i'm doing wrong?
void loop() {
printWifiStatus();
// Connect to the server (your computer or web page)
if (client.connect(server, 80)) {
Serial.println("--> connection ok\n");
Serial.println("1000");
client.print("GET /write_met.php?"); // This is the get request
client.print("temperature="); // This is the temperature
client.print("100"); // And this is what we did in the testing section above. We are making a GET request just like we would from our browser but now with live data from the sensor
client.print("&leafwetness=");
client.print("100");
client.println(" HTTP/1.1"); // Part of the GET request
client.print( "Host: " );
client.println(server);
client.println("Connection: close"); // Part of the GET request telling the server that we are over transmitting the message
client.println(); // Empty line
client.println(); // Empty line
client.stop(); // Closing connection to server
Serial.println("--> finished transmission\n");
Anything obvious with what i'm doing wrong?