if (!client.connect(host, httpPort)
if (!client.connect(maker.ifttt.com, 80)
Here is my full code:
#include <ESP8266WiFi.h>
const char* ssid = "HelloSweetie-2.4";
const char* password = "---";
const char* host = "maker.ifttt.com";
const char* apiKey = "dtroLxkk-EmuH6M31vPC7K";
String input = "";
String messageBody = "Body of test message.";
void setup() {
Serial.begin(115200);
delay(100);
WiFi.begin(ssid,password);
}
void loop() {
if (Serial.available()) {
input = Serial.readString();
delay(1000);
if (input = "send") {
Serial.println("Confirmed");
Serial.print("Connecting to ");
Serial.println(host);
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) { //this section seems to be my problem
Serial.println("Connection failed");
return;
}
String url = "/trigger/send/with/key/";
url += apiKey;
Serial.print("Requesting URL: ");
Serial.println(url);
client.print(String("POST") + url + "HTTP/1.1\r\n" + "Host: " + host + "\r\n" +
"Content-Type: application/x-www-form-urlencoded\r\n" + "Content-Length: 13\r\n\r\n" +
"value1=" + messageBody + "\r\n");
} else {
Serial.println("Invalid input. Try again.");
}
input = "";
}
}
And here is the information from IFTTT on how to trigger the event (specific for my sending an e-mail event), for anyone not familiar with the site.
Can someone assist? Either help me figure out how to get more useful debug information so I actually have an error I can google search, or help me figure out what I'm doing wrong? Thank you.