Hi. I would like to add a string to my HTTP POST request. I want the string to be based off of whatever input i type in to the serial monitor. This I know how to do, but it still doesn't send the POST request. I think the problem is that the post request is an int called httpCode, and therefore I can't store my string in the int. The int I'm talking about is defined as follows:
int httpCode = http.POST("number=3&submit=enter"); //Send the request
Basically I want the post requests number to be whatever number i type into the Serial Monitor. So If I type in the number 5 in the serial monitor it will then send the request http.POST("number=5&submit=enter"), but since I'm trying to add a string to the int I can't get this to work.
For good measures I'm posting the essential part of the code below.
}
void loop() {
HTTPClient http; //Declare object of class HTTPClient
No, no, the POST is not defined as an int. The int you're talking about is the result of the POST request. It's the HTTP status code and it tells you whether the request was successful or not. The payload (body) is supplied as the parameter to http.POST(...). Just replace whatever data you have there by the data you want to send.
The only place I define my request is in the int. I don't have any data in the string payload, therefore there is nothing to replace. The snippet of code I posted above is literally from my program - no edits or anything.