I’ve been trying to get a piece of code that sends a text message to a phone when an [ IFTTT applet site is visited, I’ve been following [this tutorial regarding the text message itself and [ this one for the WiFi shield for the ability to connect to a webpage and an HTTP request.
Here is the code I currently am trying to get to work (I removed any network info and the textmessage trigger link for privacy):
#include <SoftwareSerial.h> // Include software serial library, ESP8266 library dependency
#include <SparkFunESP8266WiFi.h> // Include the ESP8266 AT library
void setup() {
Serial.begin(9600);
String url = "/trigger/ESP/with/key/dwSukgpyQsyampQMkXXXX";
Serial.print (url);
// put your setup code here, to run once:
if (esp8266.begin()) // Initialize the ESP8266 and check it's return status
Serial.println("ESP8266 ready to go!"); // Communication and setup successful
else
Serial.println("Unable to communicate with the ESP8266 :(");
int retVal;
retVal = esp8266.connect("network", "networkpassword");
if (retVal < 0)
{
Serial.print(F("Error connecting: "));
Serial.println(retVal);
}
IPAddress myIP = esp8266.localIP(); // Get the ESP8266's local IP
Serial.print(F("My IP is: ")); Serial.println(myIP);
ESP8266Client client; // Create a client object
retVal = client.connect("maker.ifttt.com" + url, 80); // Connect to sparkfun (HTTP port)
if (retVal > 0)
Serial.println("Successfully connected!");
client.print("GET / HTTP/1.1\nHost: maker.ifttt.com" + url + "\nConnection: close\n\n");
while (client.available()) // While there's data available
Serial.write(client.read()); // Read it and print to serial
}
void loop() {
// put your main code here, to run repeatedly:
}
In line 27 you can see I’m trying to connect to the site which will send a text message out but the issue is that it will not connect to the full desired site. Basically, my problem is that it will connect to any “simple” site like google.com but it can’t for “longer/complex” links. I was wondering if you would have any idea how would I solve this problem and get this to work. I’ve tried just using the addition symbol to combine the “simple” link and the rest of my desired link but that doesn’t work either.
Here’s the Arduino connecting to simple site working smoothfully:
Here’s the Arduino connecting to my desired “complex link” site which doesn’t work:
Some other questions:
Thank you and I will appreciate any help I could get!](https://learn.sparkfun.com/tutorials/esp8266-wifi-shield-hookup-guide#installing-the-esp8266-at-library)](How to Send Text Message (SMS) using ESP8266)](Explore Integrations - IFTTT)