arduino/libraries/ESP8266RestClient/examples/simple_POST/simple_POST.ino
2018-11-03 20:21:33 +00:00

28 lines
611 B
C++

/* RestClient simple GET request
*
* by Fabiano França (fabianofranca)
*/
#include "RestClient.h"
RestClient client = RestClient("arduino-http-lib-test.herokuapp.com");
//Setup
void setup() {
Serial.begin(9600);
Serial.println("connect to WiFi network");
client.begin("ssid", "password");
Serial.println("Setup!");
}
String response;
void loop(){
response = "";
int statusCode = client.post("/data", "POSTDATA", &response);
Serial.print("Status code from server: ");
Serial.println(statusCode);
Serial.print("Response body from server: ");
Serial.println(response);
delay(1000);
}