gpt4 book ai didi

php - 通过 phpmyadmin Arduino 到 MySQL

转载 作者:行者123 更新时间:2023-11-29 22:07:35 24 4
gpt4 key购买 nike

编辑:2015 年 8 月 22 日 @ 22:44z

大家好,

我的“发布”和“显示”PHP 可以工作。我已经彻底检查了两者。我几乎可以肯定问题出在下面的代码中,只是不知道问题出在哪里。

问题是“为什么 arduino/wifishield 无法连接到由 phpmyadmin 管理的 NetSol 托管的 MySQL 数据库?”我已将 DB IP 地址、通行证、用户名等融入到 PHP 中。

这是我正在使用的 C 代码:

void postData() {
if (client.connect(server, 80)) {
Serial.println("connecting...");
client.println("POST /insert_mysql.php HTTP/1.1")
//I've verified this PHP connects to the DB via the IP address
client.println("Host: www.<my_website>.com"); //hosted by NetSol
client.println("User-Agent: Arduino/1.0"); //should this be 2.0?
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded;");
client.print("Content-Length: ");
client.println(yourdata.length());
client.println();
client.println(yourdata);
}
else {
Serial.println("Connection failed");
Serial.println("Disconnecting.");
client.stop();
}
}

最佳答案

这是一个非常简单的解决方案......

1.) WiFi Shield 需要将固件升级到 1.1.0
2.) 防护罩的天线很弱,所以我必须获得更好的信号

关于php - 通过 phpmyadmin Arduino 到 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32002311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com