-->
Page 1 of 2

GET command returns 'wrong syntax'

PostPosted: Sun Feb 08, 2015 3:03 pm
by jqdoumen
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?

Re: GET command returns 'wrong syntax'

PostPosted: Mon Feb 09, 2015 4:21 am
by Athena
Hi,

I'm using Espressif Official AT firmware ,and it works fine..

http://bbs.espressif.com/viewtopic.php?f=5&t=154

SEND_HTTP_TEST.png
SEND_HTTP_TEST.png (3.82 KiB) Viewed 5985 times

SEND_HTTP_TEST_RESULT.png
SEND_HTTP_TEST_RESULT.png (4.02 KiB) Viewed 5985 times

Re: GET command returns 'wrong syntax'

PostPosted: Mon Feb 09, 2015 4:44 pm
by jqdoumen
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 ... :(

Re: GET command returns 'wrong syntax'

PostPosted: Tue Feb 10, 2015 3:31 am
by Athena
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: */*

"
.....