A simple GET respond from Amazon ?
Posted: Fri Oct 16, 2015 9:46 am
Keep getting bad request respond from the server , and if i remove the \r\n at the end i dont get even this .
Seems there is a problem with my cr nl .
This code ,
produce in the terminal this ( in one line !!! ) :
and here there is the bad respond error ( +ipd etc )
Seems there is a problem with my cr nl .
This code ,
Code: Select all
char *hdr[] =
{
"GET /index.php HTTP/1.1\r\n ",
"Host:x2.xx.xxx.xx\r\n ",
"User-Agent:runscope/0.1\r\n ",
"Accept-Encoding:gzip, deflate\r\n",
"Accept-Language:en-us\r\n",
"Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n",
"Connection:close\r\n\r\n",
NULL
};
total_len=0;
for(int i=0; hdr[i]!=NULL; i++) // get total length of data to send
total_len+=strlen(hdr[i]);
// set channel and length of transfer
sprintf(cmd,"AT+CIPSEND=%d,%d",id,total_len);
wifiSerial.println(cmd);
// wait for '>' and send data
if( waitFor( ">", 5000 ) )
{
for(int i=0; hdr[i]!=NULL; i++)
wifiSerial.print(hdr[i]);
produce in the terminal this ( in one line !!! ) :
Code: Select all
AT+CIPSEND=0,218
OK
> GET /index.php HTTP/1.1
Host:xx.xx.xxx.xx
User-Agent:runscope/0.1
Accept-Encoding:gzip, deflate
Accept-Language:en-us
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Connection:close
Recv 218 bytes
SEND OK
and here there is the bad respond error ( +ipd etc )