POST request using AT Commands
Posted: Mon Jan 25, 2016 12:14 am
Hi. I am new to this forum. I am using ESP8266 with AT version:0.21.0.0 and SDK version:0.9.5 . I am using this with Arduino Uno R3 to send a POST request to a remote server that I have created. I am able to connect to the server using AT+CIPSTART as well as send data, My question is: POST Requests have a definite format which involves going to the next line. I tried \r\n but the data always gets appended in the same line, due to which it throws a Code 400 Bad Syntax error. Please tell me how to go to the next line. Help will be genuinely appreciated from fellow bloggers.
My POST Request
POST /test HTTP/1.1\r\nHost: XXX.XXX.X.XXX\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 21\r\n\r\token=1&pin=12&ts=1\r\n\r\n
Baud Rate: 9600
Both NL&CR enabled in Serial Monitor Arduino IDE
My POST Request
POST /test HTTP/1.1\r\nHost: XXX.XXX.X.XXX\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 21\r\n\r\token=1&pin=12&ts=1\r\n\r\n
Baud Rate: 9600
Both NL&CR enabled in Serial Monitor Arduino IDE