标签:for nec tpc class div ret loop include turn
参考:https://www.qutaojiao.com/8043.html
ESP8266的HTTP请求:http://www.taichi-maker.com/homepage/iot-development/iot-dev-reference/esp8266-c-plus-plus-reference/esp8266httpclient/
Arduino中的示例HTTPClient中的BasicHTTPClient和BasicHTTPSClient可以作为参考
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "hg2020";
const char* password = "12345678";
void setup() {
Serial.begin(115200);
delay(400);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
}
void loop() {
if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
HTTPClient http;
http.begin("http://quan.suning.com/getSysTime.do"); //Specify the URL
int httpCode = http.GET(); //Make the request
if (httpCode > 0) { //Check for the returning code
String payload = http.getString();
Serial.println(httpCode);
Serial.println(payload);
}
else {
Serial.println("Error on HTTP request");
}
http.end(); //Free the resources
}
delay(1000);
}
标签:for nec tpc class div ret loop include turn
原文地址:https://www.cnblogs.com/dengziqi/p/14196706.html