Hello,
I have a code that I wrote a string and then post to a local server.
I created a string in Json Format, but when I get that string in server side is not equal to client side
String json = {"opcion":"2","nombre":""+nombre+"","valor":""+valor+"","estado":""+estado+"","modo":""+modo+""}";
Serial.println(json);
if (client.connect("192.168.1.126",80)) { // REPLACE WITH YOUR SERVER ADDRESS
client.println("POST /index.php HTTP/1.1"); // HTTP POST TO /results
client.println("Host: 192.168.1.126"); // SERVER ADDRESS HERE TOO
client.println("Content-Type: application/json"); // DATA TYPE
client.print("Content-Length: ");
client.println(json.length());
client.println();
client.print(json);
Serial.println("Dato del "+nombre+" enviado");
}
if (client.connected()) {
client.stop(); // DISCONNECT FROM THE SERVER
}
delay(100); // 5 SECONDS DELAY
I receive this in servr side
{"opcion":"2","nombre":"Sensor001","valor":"27.00*C
","estado":"INACTIVO","modo":"Automatico"}
I dont want to use library, what is the problem with my coide