将数据从NodeMcu发送到Web服务器

时间:2019-12-10 12:57:44

标签: php server nodemcu

我正在将数据从nodemcu发送到网络托管服务器上的phpMyAdmin表。

如果我在网络搜索中输入了带有值的PHP,我已经制作了一个PHP脚本,可以将值发送到表中。当我尝试使用自己的nodemcu进行连接时,它可以毫不费力地连接,但不会发送值。

void Sending_To_phpmyadmindatabase() {
 if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    Serial.print("GET /Arduino/dht.php?PHValue=");
    client.print("GET /Arduino/dht.php?PHValue=");    
    Serial.println(PHValue);
    client.print(PHValue);
    client.print("&temperature=");
    Serial.println("&temperature=");
    client.print(temperatureData);
    Serial.println(temperatureData);
    client.print(" ");      //SPACE BEFORE HTTP/1.1
    client.print("HTTP/1.1");
    client.println();
    client.println("HOST: ####");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
}

0 个答案:

没有答案
相关问题