secrets secrets - 1 month ago 23
HTTP Question

How can I access web site with ESP8266?

I'm trying to retrieve a HTTP resource (

http://srcafe21.cafe24.com/mylight.php?id=2
) using ESP8266:

ESP8266 AT commands :
AT+CWMODE=3
AT+RST
AT+CWJAP="iptime-3","20030214"
AT+CIFSR
AT+CIPMUX=0
AT+CIPSTART="TCP","srcafe21.cafe24.com",80
AT+CIPSEND=60
GET/HTTP/1.1
Host:srcafe21.cafe24.com/mylight.php?id=2
AT+CIPCLOSE


I get this response:


SEND OK +IPD,311:HTTP/1.1 400 Bad Request
Server: nginx Date: ....



What am I doing wrong?

Answer

Your use of HTTP is wrong. It should be

GET /mylight.php?id=2 HTTP/1.1
Host: srcafe21.cafe24.com