1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include "httpclient.h"
- #include "string.h"
- #include "stdio.h"
- uint8_t http_data[6*1024];
- //GET请求 http://gpu.ringzle.com/iot/transmit/getTransmitConfig?deviceId=297877563234 端口号8082
- void http_getDemo(void)
- {
- int datalen;
- int ret;
-
- memset(http_data, 0, sizeof(http_data));
-
- ret = http_clientGet("gpu.ringzle.com", "/iot/transmit/getTransmitConfig?deviceId=297877563234", 8082, 0, http_data, &datalen);
- HTTP_PRINTF("%s", (char *)http_data);
- HTTP_PRINTF("\r\n ret=%d datalen=%d\r\n", ret, datalen);
- }
- char *postData = "{\"bandwidth\":250,\"codeRate\":4700}";
- uint8_t postResult[512];
- //POST请求 http://gpu.ringzle.com/iot/test/httpTest 端口号8082
- void http_postDemo(void)
- {
- int datalen, ret;
-
- memset(postResult, 0, sizeof(postResult));
-
- // ret = http_clientPost("gpu.ringzle.com", "/iot/test/httpTest", 8082, 0, http_data, 5837, postResult, &datalen);
- ret = http_clientPost("gpu.ringzle.com", "/iot/test/httpTest", 8082, 0, (uint8_t *)postData, strlen(postData), postResult, &datalen);
-
- HTTP_PRINTF("%s", (char *)postResult);
- HTTP_PRINTF("\r\n ret=%d datalen=%d\r\n", ret, datalen);
- }
|