#include #include // Replace with your WiFi credentials const char* ssid = "wifi-ssid"; const char* password = "wifi-password"; // Replace with your API details const char* apiHost = "weather.eolab.de"; const char* apiEndpoint = "/api"; // Create an instance of WiFiClientSecure WiFiClientSecure client; void setup() { Serial.begin(115200); // Connect to Wi-Fi WiFi.begin(ssid, password); Serial.print("Connecting to "); Serial.print(ssid); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.print("."); } Serial.println("\nConnected to WiFi"); // Set the client to verify the server's certificate client.setInsecure(); // Give the client a chance to perform the handshake delay(1000); } void loop() { if (WiFi.status() == WL_CONNECTED) { // Make an HTTPS GET request client.connect(apiHost, 443); // Use port 443 for HTTPS client.print(String("GET ") + apiEndpoint + " HTTP/1.1\r\n" + "Host: " + apiHost + "\r\n" + "Connection: close\r\n\r\n"); // Wait for the response while (client.connected()) { String line = client.readStringUntil('\n'); if (line == "\r") { Serial.println("Headers received"); break; } } // Print the response from the server while (client.available()) { String response = client.readStringUntil('\n'); Serial.println(response); } client.stop(); } // Wait for a while before making the next request delay(5000); }