Hello everyone
I want to send a single json buffer to a local server using STM32 with esp8266 using AT commands, the esp connect successfully to the wifi but I receive nothing on the server. when I did sime debugging and see the esp response it gave me this:
AT+CIPSTART="TCP","192.168.137.1",5000"
ERROR
AT+CIPSEND=109
POST / HTTP/1.1
busy p...
Host: 192.168.137.1
busy p...
Content-Type: application/json
busy p...
Content-Lengthlink is not valid
ERROR
: 427
ERROR
ERROR
{"key":"value"}AT+CIPCLOSE
and this is my code part sending data:
void sendDataToServer(const char* jsonPayload) {
// Establish TCP connection to the server
ESP8266_SendATCommand("AT+CIPSTART=\"TCP\",\"192.168.137.1\",5000\"\r\n");
HAL_Delay(1000);
// Prepare HTTP POST request
char httpHeader[128];
snprintf(httpHeader, sizeof(httpHeader),
"POST / HTTP/1.1\r\n"
"Host: 192.168.137.1\r\n"
"Content-Type: application/json\r\n"
"Content-Length: %d\r\n"
"\r\n",
strlen(jsonPayload));
// Combine headers and payload for sending
snprintf(requestBuffer, sizeof(requestBuffer), "%s%s", httpHeader, jsonPayload);
// Send request
snprintf(commandBuffer, sizeof(commandBuffer), "AT+CIPSEND=%d\r\n", strlen(requestBuffer));
ESP8266_SendATCommand(commandBuffer);
ESP8266_SendATCommand(requestBuffer);
// Close TCP connection
ESP8266_SendATCommand("AT+CIPCLOSE\r\n");
}
could you please help me ?
Post json using AT commands
Post json using AT commands
- Attachments
-
- Screenshot 2023-08-15 152431.png (12.05 KiB) Viewed 6719 times
-
- Screenshot 2023-08-15 152431.png (12.05 KiB) Viewed 6719 times
Re: Post json using AT commands
could you please provide the GPIO2 logs and capture packets for debugging, and what's the response of AT+GMR.
Who is online
Users browsing this forum: No registered users and 17 guests