Hi
"This library has been deprecated in favor of our rpcWifi library. "
If you see this library in example BasicHttpsClient, they are using “#include <HTTPClient.h>”
I started from this example Seeed_Arduino_rpcWiFi and I tried to connect to script.google.com, but sometimes it works, others don’t
log
00:30:21.727 -> [HTTPS] begin…
00:30:21.727 -> [HTTPS] GET…
00:30:24.298 -> [HTTPS] GET… code: 200
00:30:24.298 -> Hello world!
00:30:24.345 ->
00:30:24.345 -> Waiting 10s before the next round…
00:30:34.351 -> [HTTPS] begin…
00:30:34.351 -> [HTTPS] GET…
00:30:36.477 -> [HTTPS] GET… failed, error: no HTTP server
00:30:36.477 ->
00:30:36.477 -> Waiting 10s before the next round…
00:30:46.457 -> [HTTPS] begin…
00:30:46.457 -> [HTTPS] GET…
00:30:48.555 -> [HTTPS] GET… failed, error: connection refused
00:30:48.555 ->
00:30:48.555 -> Waiting 10s before the next round…
00:30:58.549 -> [HTTPS] begin…
00:30:58.549 -> [HTTPS] GET…
00:31:00.752 -> [HTTPS] GET… failed, error: no HTTP server
00:31:00.752 ->
00:31:00.752 -> Waiting 10s before the next round…
00:31:10.736 -> [HTTPS] begin…
00:31:10.736 -> [HTTPS] GET…
00:31:13.124 -> [HTTPS] GET… code: 200
00:31:13.124 -> Hello world!
00:31:13.170 ->
00:31:13.170 -> Waiting 10s before the next round…
/**
BasicHTTPSClient.ino
Created on: 14.10.2018
*/
#include <rpcWiFi.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
WiFiClientSecure client;
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.begin("…", “…”);
// wait for WiFi connection
Serial.print(“Waiting for WiFi to connect…”);
while ((WiFi.status() != WL_CONNECTED)) {
Serial.print(".");
}
Serial.println(" connected");
//client.setCACert(test_root_ca);
}
void loop() {
String checkUrl = “https://script.google.com/macros/s/AKfycbyVlx63MncBiza4pWnuHV2U22tunVHcqh-YKlSPT17EQx-n-Jh8H3laEWW_eciqvZ-iSg/exec?pulsante=1”;
if (&client) {
{
// Add a scoping block for HTTPClient https to make sure it is destroyed before WiFiClientSecure *client is
HTTPClient https;
//https.setTimeout(10000);
https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
Serial.print("[HTTPS] begin…\n");
if (https.begin(client, checkUrl)) { // HTTPS
Serial.print("[HTTPS] GET…\n");
// start connection and send HTTP header
int httpCode = https.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = https.getString();
Serial.println(payload);
}
} else {
Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
}
https.end();
} else {
Serial.printf("[HTTPS] Unable to connect\n");
}
// End extra scoping block
}
} else {
Serial.println(“Unable to create client”);
}
Serial.println();
Serial.println(“Waiting 10s before the next round…”);
delay(10000);
}