As already said in the comments you need client code - Here are ready to use blocks for your scenario - NEVER use String class if you want to have a stable running IoT device, so define global char arrays (compiled to flash) and keep heap fragmentation at a minimum, The code is commented to get you started, change to your needs:
/* Your constants */
#define READ_THIS_PIN 4
const char MakerIFTTT_Key[] = "r8X-blahblahYourKeyGoesHere";
const char MakerIFTTT_Event[] = "stack_exchange_example";
/* Define global char arrays to get rid of string class */
char numBuf[20]; // We "just know" this is big enough for (un)signed longs
char postRequest[256]; // Hand-calculated to be big enough (size to your needs)
/* Helper functions for constructing the POST data
append a string or int to a buffer, return the resulting end of string */
char *appendStr(char *tempChr, char *s) {
while ((*tempChr++ = *s++))
;
return tempChr-1;
}
char *appendUl(char *tempChr, unsigned long u) {
return appendStr(tempChr, ultoa(u, numBuf, 10));
}
/*
This is called once per iteration to read the pin
and send a POST to trigger the IFTTT/Maker event
*/
void updateEvent() {
WiFiClient client;
/* Connect to the Maker event server */
client.connect("maker.ifttt.com", 80);
/* Construct the POST request */
postRequest[0] = {'\0'}; /* Reset char array */
char *p = postRequest;
p = appendStr(p, "POST /trigger/");
p = appendStr(p, "MakerIFTTT_Event");
p = appendStr(p, "/with/key/");
p = appendStr(p, "MakerIFTTT_Key");
p = appendStr(p, " HTTP/1.1\r\n");
p = appendStr(p, "Host: maker.ifttt.com\r\n");
p = appendStr(p, "Content-Type: application/json\r\n");
p = appendStr(p, "Content-Length: ");
/* We need to remember where the content length will go, which is: */
char *contentLengthHere = p;
/* It's always two digits, so reserve space for them (the NN) */
p = appendStr(p, "NN\r\n");
/* End of headers */
p = appendStr(p, "\r\n");
/* Construct the JSON; remember where we started so we will know len */
char *jsonStart = p;
// This example reports a pin, uptime, and "hello stack" change to your need */
p = appendStr(p, "{\"value1\":\"");
p = appendUl(p, 12); //analogRead(READ_THIS_PIN));
p = appendStr(p, "\",\"value2\":\"");
p = appendUl(p, millis());
p = appendStr(p, "\",\"value3\":\"");
p = appendStr(p, "hello, stack!");
p = appendStr(p, "\"}");
/* Go back and fill in the JSON length
we just know this is at most 2 digits (and need to fill in both) */
uint8_t i = strlen(jsonStart);
contentLengthHere[0] = '0' + (i/10);
contentLengthHere[1] = '0' + (i%10);
// finally we are ready to send the POST to the server!
client.print(postRequest);
client.stop();
}