I found this nice example on building a gps-sd-wifi project.
The problem is in github the php file is not included.
How should I read the data coming from an ESP8266 (or equivalent) using this code as the sender...
I would like to get all the data and be able to save it to a file, or redirect it to mysql.
Thank you
void uploadTrack(char* name){
File log = SD.open(name);
WiFiClient client;
int tracker = ESP.getChipId();
String trackerId = String(tracker);
Serial.printf("Uploading %s
", name);
if(client.connect("tracker.brixit.nl", 80)){
Serial.println("Sending headers");
String length = String(log.size());
String headers = String("POST /upload.php HTTP/1.0
")+
"Host: tracker.brixit.nl
" +
"Connection: close
" +
"Content-Type: text/csv
" +
"Content-Length: " + length + "
" +
"X-Tracker: " + trackerId + "
" +
"X-Secret: " + secret + "
" +
"X-Track: " + name + "
" +
"
";
client.print(headers);
Serial.println("Sending data");
char buffer[1470];
while(true){
int bytes = log.read(buffer,1470);
if(bytes < 1){
break;
}
client.write_P(buffer, bytes);
delay(0);
}
Serial.println("Upload done");
client.stop();
}
}