Need help sending GET request to IFTTT with ESP8266

I have an ESP8266 that I want to send off a GET request to ifttt.com to trigger an action. Here's the code that sends off the request:

WiFiClient client;
  if (client.connect("maker.ifttt.com", 80)) {
    Serial.println("Connected");
    
    String url = "/trigger/trap_triggered/with/key/{key}";
    Serial.print("requesting URL: ");
    Serial.println(url);
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Connection: close\r\n\r\n");
    Serial.println("request sent");
  }

*Note that in my actual code I've replaced {key} with my actual verified app key from ifttt.

The problem is that when the request gets sent off my ifttt service never receives it. I don't get any errors, everything seems to work fine on the ESP side. So I tested ifttt by putting the exact same request into a browser and it works perfectly every time. So it seems like my request is not making it from my ESP to ifttt.

Any thoughts on what the issue could be?

I recommend you try the 'ESP8266HTTPClient' library starting with the BasicHttpClient example. That will give you the HTTP status code which will tell you if the URL has a problem or the server has a problem.

Used the BasicHttpClient example you referenced and substituted in my network info and also my ifttt url. The code I'm getting back is 200, and using that example, I can see that ifttt did receive the request. So that works and I can use the setup from the example, but still not sure why my setup wasn't connecting....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.