I have a, Arduino sketch that every 10 minutes, writes temprature data to SD text file and post that data to web server.
In case of internet connection loss, the sketch continues to save data to SD text file (but not post it to web). When the internet connection is back again, then I need to read entire text file from SD card and post it to the web server (a php script receive the posted content)
Using the following code I can post to php scripts. But now I need the postdata variable contains the text file.
if (client.connect("192.168.1.100", 80))
{
client.println("POST /readfile.php HTTP/1.1");
client.println("Host: 192.168.1.100");
client.println("User-Agent: Arduino/1.0");
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded");
client.print("Content-Length: ");
client.println(postdata.length());
client.println("");
client.println(postdata);
delay(1);
client.stop();
So I need a way to read the text file in a String (or whatever) variable.
I can use Arduino UNO, MEGA or ESP32 Thanks in advance!