#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "Wokwi-GUEST";
const char* password = "";
const char* token = "27Ad3BqQdFLJPEJBGmmZoB68cMwSSmWRXS7JPJeM4Fn";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
Serial.println(" READY ");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin("https://notify-api.line.me/api/notify");
http.addHeader("Authorization", "Bearer " + String(token));
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
http.POST("message=High temperature !!!");
int httpCode = http.POST("READY . . ."); // Use an empty POST request to send only headers
if (httpCode > 0) {
String response = http.getString();
Serial.print("HTTP Response code: ");
Serial.println(httpCode);
Serial.print("Server response: ");
Serial.println(response);
} else {
Serial.println(".....");
}
http.end();
delay(5000); //
}
}