1
我在使用PHP在Arduino中使用GET发送数据时遇到问题。我从Arduino IDE打开WebClient代码,只需更改char server []并获取东西。Arduino以太网盾 - GET - WebClient - 400错误请求
我使用该代码将记录添加到我的MySQL数据库。
http://cineksuw.hol.es/mysql.php?d=10&t=20&h=30&p=40
正如你可以看到它的工作,所以我试图做到这一点使用的Arduino:
char server[] = "http://cineksuw.hol.es";
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /mysql.php?d=1&t=5&h=1&p=4 HTTP/1.1");
client.println("Host: http://cineksuw.hol.es");
client.println("Connection: close");
client.println();}
但是这个代码不工作,我得到的是:
connecting...
connected
HTTP/1.1 400 Bad Request
Server: nginx/1.9.3
Date: Tue, 13 Oct 2015 10:42:57 GMT
Content-Type: text/html
Content-Length: 172
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.9.3</center>
</body>
</html>
disconnecting.
是什么问题?感谢帮助。
谢谢,我改变这种状况,但仍是问题。现在没有关系。 '连接... 连接失败 断开连接。 ' 但是,当我再次将'char server'更改为google.com时,它连接时没有问题。我的网站是好的,工作。 – MarcinAWK