I am trying to GET a TalkBack Command on Thingspeak.com using Arduino IDE but i am not getting any response on Serial Monitor. I have tested the following GET request with the Poster. it works perfectly.
https://api.thingspeak.com/talkbacks/74 ... FUJBI6Z115
#include <ESP8266WiFi.h>
const char* ssid = "XXX";
const char* password = "YYYYY";
const char* host = "api.thingspeak.com";
// Use WiFiClient class to create TCP connections
WiFiClient client;
void setup() {
Serial.begin(115200);
delay(100);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
Serial.print("connecting to ");
Serial.println(host);
if (client.connect(host,80)) { // "184.106.153.149" or api.thingspeak.com
String postStr = "GET /talkbacks/7441/commands/1145081?api_key=WSMCMVFUJBI6Z115 HTTP/1.1\n";
client.print(postStr);
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
}
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
char c = client.read();
Serial.print(c);
}
client.stop();
Serial.println();
Serial.println("closing connection");
delay(15000);
}
i think something is wrong with my GET request
What is the correct way to send Talkback GET request ?