如何使用 Nodemcu 单击 link

How to click link using Nodemcu

如何使用nodeMCU点击link?

我正在使用 NodeMCU 0.9(ESP-12 模块)

Link: https://docs.google.com/forms/d/e/1FAIpQLSc6pufV7ikz8nvm0pFIHQwzfawNKY2b2T5xJH4zYkQn3HJL3w/viewform?usp=pp_url&entry.496898377=Volt&entry.554080438=Amp&entry.79954202=Power&entry.2022387293=Ah&entry.1863631882=Wh

实际上,这是 google 表格前字段 link。

使用 ESP8266 发送 HTTP get 请求非常简单。只需 setup your IDE. Then use builtin HTTPClient 发送 HTTP 请求:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

const char *ssid = "yourNetworkName";
const char *password = "yourNetworkPassword";

const char *url = "http://docs.google.com/forms/d/e/1FAIpQLSc6pufV7ikz8nvm0pFIHQwzfawNKY2b2T5xJH4zYkQn3HJL3w/viewform?usp=pp_url&entry.496898377=Volt&entry.554080438=Amp&entry.79954202=Power&entry.2022387293=Ah&entry.1863631882=Wh";

void send_request()
{
    //Check WiFi connection status
    if (WiFi.status() == WL_CONNECTED)
    {
        //Declare an object of class HTTPClient
        HTTPClient http;
        http.begin(url);           //Specify request destination
        int httpCode = http.GET(); //Send the request
        //Check the returning code
        if (httpCode > 0)
        {
            //Get the request response payload
            String payload = http.getString();
            //Print the response payload
            Serial.println(payload);
        }
        //Close connection
        http.end();
    }
}

void setup()
{
    Serial.begin(115200);
    WiFi.begin(ssid, password);
    Serial.print("Connecting.");
    // Checking Wifi connectivity
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(1000);
        Serial.print(".");
    }
    Serial.println("\nConnected !");
    // Sending request
    send_request();
}

void loop()
{
}