I am trying to make a simple project where the esp8266 sends an sms to my phone using IFTTT. I have tested my IFTTT applet/recipe and it works fine. I thought it might be a connection issue with my wifi, i have found that to not be the problem too. So I checked for a connection issue with the host and that seems to be the problem. It prints connection failed according to this piece of code :
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
Can someone please help me with this problem. Thank you
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
const char* ssid = "ssid";
const char* password = "pass";
const char* host = "maker.ifttt.com";
const int httpsPort = 443;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
WiFiClientSecure client;
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}
String url = "/trigger/ESP8266/json/with/key/xxxxxxxxxx";
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"User-Agent: BuildFailureDetectorESP8266\r\n" +
"Connection: close\r\n\r\n");
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
}
String line = client.readStringUntil('\n');
}
void loop() {
}```
[1]: https://i.stack.imgur.com/RkQqL.png