Hey!
Is it possible to do a POST request using just the url to parse a value using the HTTPclient.h library? I am able to do it using POSTman. But I can't using my ESP32. What am I missing?
Kind regards Alexander
void loop() {
//Send an HTTP POST request every 10 minutes
if ((millis() - lastTime) > timerDelay) {
//Check WiFi connection status
if(WiFi.status()== WL_CONNECTED){
if(WiFi.status()== WL_CONNECTED){ //Check WiFi connection status
HTTPClient http;
String value = "99"
http.begin("http://randomurl.com/arrive/"+ value); //Specify destination for HTTP request
http.addHeader("Content-Type", "x-www-form-urlencoded"); //Specify content-type header
int httpResponseCode = http.POST(); //Send the actual POST request
if(httpResponseCode>0){
String response = http.getString(); //Get the response to the request
Serial.println(httpResponseCode); //Print return code
Serial.println(response); //Print request answer
}else{
Serial.print("Error on sending POST: ");
Serial.println(httpResponseCode);
}
http.end(); //Free resources
}
else {
Serial.println("WiFi Disconnected");
}
lastTime = millis();
}
}
}```