From 7a4b4cb2ff9db1d5a3a8ba750e1a2eeea9a30305 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 21 Aug 2022 10:46:23 -0700 Subject: [PATCH] Add POST example --- .../examples/PostHttpClient/PostHttpClient.ino | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/libraries/HTTPClient/examples/PostHttpClient/PostHttpClient.ino b/libraries/HTTPClient/examples/PostHttpClient/PostHttpClient.ino index 01f232aa..34d5fadb 100644 --- a/libraries/HTTPClient/examples/PostHttpClient/PostHttpClient.ino +++ b/libraries/HTTPClient/examples/PostHttpClient/PostHttpClient.ino @@ -8,16 +8,6 @@ #include #include -/* this can be run with an emulated server on host: - cd esp8266-core-root-dir - cd tests/host - make ../../libraries/ESP8266WebServer/examples/PostServer/PostServer - bin/PostServer/PostServer - then put your PC's IP address in SERVER_IP below, port 9080 (instead of default 80): -*/ -//#define SERVER_IP "10.0.1.7:9080" // PC address with emulation on host -#define SERVER_IP "192.168.1.42" - #ifndef STASSID #define STASSID "your-ssid" #define STAPSK "your-password" @@ -47,10 +37,11 @@ void loop() { if ((WiFi.status() == WL_CONNECTED)) { HTTPClient http; + http.setInsecure(); Serial.print("[HTTP] begin...\n"); - // configure traged server and url - http.begin("http://" SERVER_IP "/postplain/"); // HTTP + // configure target server and url + http.begin("https://httpbin.org/post"); http.addHeader("Content-Type", "application/json"); Serial.print("[HTTP] POST...\n");