( EspOS | 2024. 02. 28., sze – 00:07 )

Nekem ez müxik:

void sendpost() {
  String purl = posts.substring(0, posts.indexOf(")"));
  String pdata = addvalstr(posts.substring(posts.indexOf("@") + 1, posts.length()));
  if (purl.substring(0, 4) != "http") { purl = F("http://") + purl; }
  HTTPClient httpClient;
  WiFiClient *client = nullptr;
  WiFiClientSecure *clients = nullptr;
  if (purl.substring(0, 5) == "https") { 
    clients = new WiFiClientSecure;
    clients->setInsecure();
    httpClient.begin(*clients, purl);
    } else {
    client = new WiFiClient;
    httpClient.begin(*client, purl);
    }
  httpClient.addHeader(F("Content-Type"), F("application/x-www-form-urlencoded"));
  poste = httpClient.POST(pdata);
  postg = httpClient.getString();
  httpClient.end();
  delete client;
  delete clients;
}