I am trying to build a home automation system and i am unable to get data from a website using the arduino sketch, however i am able to get data from the website when i enter the AT commands into the serial monitor.Below is my sketch:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(4,5);
void setup(){
Serial.begin(9600);
esp8266.begin(115200);
esp8266.println("AT+CIPMUX=1\r\n");
delay(2000);
esp8266.println("AT+CIPSTART=0,\"TCP\",\"www.homeautomationserver.com\",80 \r\n");
delay(2000);
esp8266.println("AT+CIPSEND=0,75");
esp8266.println("GET /f/pw9e1acqx7yb0gl.txt HTTP/1.1\r\n");
esp8266.println("Host:www.homeautomationserver.com\r\n\r\n");
}
void loop(){
if (esp8266.available()){
Serial.write(esp8266.read());
}
if (Serial.available()){
esp8266.write(Serial.read());
}
}
I get a 501 not Implemented error from the server.
Please Help.
Thanks
Connection: close
in your headers as well, so the server doesn't try and keep the connection open longer than needed. – Majenko Sep 20 '16 at 9:34Content-length: ???
might help too. (??? should be the message size) – Matt Sep 20 '16 at 10:05esp8266.println()
withesp8266.print()
, because you already append "\r\n" in your strings. – jfpoilpret Sep 20 '16 at 21:18