I'm trying to make an http request on pushingbox using Arduino UNO R3 and ESP8266-1. I'm using Software Serial: SoftwareSerial ESP8266 (2, 3);
I can connect to my wifi and post data to thingspeak but not in pushingbox.
This is the code. Any idea;
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += "api.pushingbox.com";
cmd += "\",80";
ESP8266.println(cmd); //send command to device
delay(3000); //wait a little while for 'Linked' response - this makes a difference
if(ESP8266.find("Error")){
Serial.println("Error posting data to pushingbox");
return;
}
cmd = "GET /pushingbox?devid=";
cmd += "xxxxxxxxxxxxxxxx"; //my devid
cmd += " HTTP/1.1\r\n"; //construct http GET request
cmd += "Host: api.pushingbox.com\r\n\r\n";
ESP8266.print("AT+CIPSEND=");
ESP8266.println(cmd.length()); //esp8266 needs to know message length of incoming message - .length provides this
if(ESP8266.find(">")) //prompt offered by esp8266
{
ESP8266.println(cmd); //this is our http GET request
}
else
{
ESP8266.println("AT+CIPCLOSE"); //doesn't seem to work here?
Serial.println("No '>' prompt received after AT+CPISEND");
}
ESP8266.println("AT+CIPCLOSE");