F1CTL/Core/Src/http_test.c

21 lines
525 B
C
Raw Normal View History

#include "http_test.h"
void http_test_request(void)
{
http_response response;
// 目标IP地址169.254.1.1
uint8_t server_ip[4] = {169, 254, 1, 1};
const char* path = "/status.xml";
// 发送GET请求
if(http_get_ip(server_ip, 80, path, &response) == HTTP_OK)
{
// 处理响应数据
response.buffer[response.length] = '\0'; // 确保字符串结束
printf("Response: %s\n", response.buffer);
}
else
{
printf("HTTP request failed\n");
}
}