21 lines
525 B
C
21 lines
525 B
C
|
#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");
|
|||
|
}
|
|||
|
}
|