i have hosted a website on the 000webhost. And i have simply written a line in paragraph tags in html file( means i have created a html file..)
so i want to know to know how i get data that data in html file on the serial moniter through esp8266.
i have written a code in the arduino ide which is....
#include <SoftwareSerial.h>
const byte rxPin = 2;
const byte txPin = 3;
SoftwareSerial ESP8266 (rxPin, txPin);
unsigned long lastTimeMillis = 0;
void setup() {
Serial.begin(9600);
ESP8266.begin(9600);
delay(2000);
}
void printResponse() {
while (ESP8266.available()) {
Serial.println(ESP8266.readStringUntil('\n'));
}
}
void loop() {
if (millis() - lastTimeMillis > 30000) {
lastTimeMillis = millis();
ESP8266.println("AT+CIPMUX=1");
delay(1000);
printResponse();
ESP8266.println("AT+CIPSTART=4,\"TCP\",\"www.tcpss.000webhostapp.com\",80");
delay(1000);
printResponse();
String cmd = "GET /index.html HTTP/1.1";
ESP8266.println("AT+CIPSEND=4," + String(cmd.length() + 4));
delay(1000);
ESP8266.println(cmd);
delay(1000);
ESP8266.println("");
}
if (ESP8266.available()) {
Serial.write(ESP8266.read());
}
}
and the response on the serial moniter is
AT+CIPMUX=1
OK
AT+CIPSTART=4,"TCP","www.tcpss.000webhostapp.com",80
4,CONNEC
AT+CIPSEND=4,28
OK
>
Recv 28 bytes
SEND OK
+IPD,4,412:HTTP/1.1 400 Bad Request
Date: Thu, 27 May 2021 18:07:45 GMT
Content-Type: text/html
Content-Length: 154
Connection: close
Server: awex
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-ID: 2eaf3c737a5348270ebe7873cab10088
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>openresty</center>
</body>
</html>
4,CLOSED
what does it mean?
thanks in advance.......
Host:
header, otherwise the web server has no clue which website you want to access.