基于ESP8266_NONOS_SDK-2.2.0
全篇使用DNS的代码稍作修改即可
#define HTTP_MESSAGE "GET http://blog.openpilot.cc/archives/1909 HTTP/1.1 \r\n" \
"Host:blog.openpilot.cc \r\n" \
"Connection:close \r\n\r\n"
void ICACHE_FLASH_ATTR ESP8266_WIFI_Rev_cb(void * arg,char * pdata,unsigned short len)
{
os_printf("esp8266 rev data =%s\r\n",pdata);
}
void ICACHE_FLASH_ATTR ESP_TCP_Connect_cb(void *arg)
{
espconn_regist_sentcb((struct espconn *)arg,ESP8266_WIFI_Send_cb);
espconn_regist_recvcb((struct espconn *)arg,ESP8266_WIFI_Rev_cb);
espconn_regist_disconcb((struct espconn *)arg,ESP8266_TCP_Dissconnect_cb);
os_printf("----ESP_TCP_CONNECT OK!----\r\n");
espconn_send((struct espconn *)arg,HTTP_MESSAGE,os_strlen(HTTP_MESSAGE));//这句是重点,向网站发送了请求信息
}
声明:
本文采用
BY-NC-SA
协议进行授权,如无注明均为原创,转载请注明转自
走着的小站
本文地址: esp8266 NONOS SDK HTTP获取
本文地址: esp8266 NONOS SDK HTTP获取