F1CTL/Core/Src/http_test.c

21 lines
525 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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");
}
}