Chat freely about anything...

User avatar
By jqdoumen
#9272 Been struggling with the ESP8266 for a few days now. I got it up-and-running, hooked on to an Arduino Uno. But when I try to access a webserver, I keep on getting 'wrong syntax'. Whether through coding the Arduino, or through the serial interface, behavior is similar.

//Check if I'm connected to the correct wifi ... chk!
T+CWJAP?
+CWJAP:"M42"
OK
//Check if status is fine ... chk!
AT+CIPSTATUS
STATUS:2
OK
//Check if I really do have an IP address ... chk! (the address is pingable from other machines on the same SSID)
AT+CIFSR
192.168.1.118
OK
//Start connection
AT+CIPSTART="TCP","192.168.1.100",80
OK
Linked
//Prepare to send the simplest of all URLs ...
AT+CIPSEND=35
//">" is returned, so we type the URL
> GET http://192.168.1.100 HTTP/1.0
wrong syntax
ERROR
SEND OK
OK

Apart from the confusing 'error' and 'ok', whatever URL I construct, with the full HTTP context, without, with GET with PUT, with whatever came up to my mind, it keeps failing. It seems to work for everybody who's websites I have been reading, but it doesn't work here, even when exactly copying code from others.

Am I overlooking something evident?
User avatar
By jqdoumen
#9353 Athena, well, I still get an error, but it seems like there is some kind of connection:

AT+CIPSTART="TCP","cn.bing.com",80
OK
Linked
AT+CIPSEND=75
> GET / HTTP/1.1 User-Agent: curl/7.37.0 Host: cn.bing.com Accept
wrong syntax
ERROR
SEND OK
+IPD,459:HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Date: Mon, 09 Feb 2015 21:21:49 GMT
Connection: close
Content-Length: 311
<!DOCTYPE HTML PUBIC -/W3//TD TL .0//E""tt:/ww.w3or/T/hml4stic.dd">
HTL>HEA><ITE>adReqes</ITE>
<MTAHTP-QUI=Cotet-Tpe Cntnt=tet/tm; haretusasii"</ED>
<BDY<h>Bd Rqust/h>
<hr<pHTP rro 40 Te rqustisbaly ored</>
/BDY</TM>
O
OK
Unlink


Still, for my internal Apach, no luck ... :(
User avatar
By Athena
#9374 Hi, jqdoumen,

It seem that you missed the \r\n .. a new line ? CR LF ? Whatever .. you can't see it , but it exists .. :oops:

It should be
"
GET / HTTP/1.1 (\r\n ,turn to the new line, you can't see it , but it exists .. )
User-Agent: curl/7.37.0 (\r\n ,turn to the new line, you can't see it , but it exists .. )
Host: cn.bing.com (\r\n ,turn to the new line, you can't see it , but it exists .. )
Accept: */* (\r\n ,turn to the new line, you can't see it , but it exists .. )
(a new line, you can't see it , but it exists .. )
"
It shows like
"
GET / HTTP/1.1
User-Agent: curl/7.37.0
Host: cn.bing.com
Accept: */*

"
.....