-->
Page 1 of 1

GET POST Request using AT commands

PostPosted: Mon Apr 11, 2016 3:50 am
by Shredinger
Firstly, sorry for my bad English.

I'm new in working with ESP8266 wifi module. I have a server with WCF service and Arduino Leonardo with connected ESP8266.
My part of code:

Code: Select allSerial1.println("AT+CIPSTART=\"TCP\",\"192.168.0.31\",7741");
delay(60000);while (Serial1.available()) Serial.write(Serial1.read());
 cmd = " GET /Service.svc/TestArduino";
 cmd += " HTTP/1.1\r\nHost: 192.168.0.31\r\nContent-Type: application/json\r\nCon­tent-Length: 20\r\n\r\nUser-Agent: test\r\n\r­\n";

  Serial1.print("AT+CIPSEND=");
  Serial1.println(cmd.length());


WCF service method url is 192.168.0.31:7741/Service.svc/TestArduino

I have some doubts about Con­tent-Length in request and formatting. I think it make sense every symbol in request string.

Now I have response 404 Bad request. Could anybody fix my mistakes or write a real working example of code. I'm also interesting in how to send request parameters (as JSON). I mean how to write it with right formatting?

Thanks all for help!