使用Ethercard库发送带有请求标头的HTTP GET

时间:2015-07-02 13:15:13

标签: html arduino ethercard

我正在尝试使用ENC28J60将arduino与调制解调器连接。我编写了我的代码,我可以使用ether.browseUrl()

浏览网址
ether.browseUrl(PSTR("/statsadsl.html"), "", website, browseUrlCallback1);

我使用上面显示的行来从该页面检索数据。

现在我需要在此链接中包含请求标头。我对TCP / IP和HTML知之甚少。但是,我需要将此请求标头的HTTP GET发送为“Connection:keep-alive”。我需要一些帮助。我联系了avrfreaks和arduino论坛以获得类似的疑问。我收到的回复不多。我希望我能从这里得到一些有用的信息。

欢迎所有类型的信息。非常感谢您提供任何帮助/信息。

1 个答案:

答案 0 :(得分:0)

在我的项目中,我使用DHT22读取湿度,温度并将其发送到我的网页。 假设,我已经阅读并准备好了所有内容,我很想把它发送到网上......

char gets[50]; // string to be sent to the server, you can access it i.e. $_GET in PHP ...

sprintf(gets,"h=%s&t=%s&c=%d",hum,tmp,readCount);   // prepare the GET, all variables in one string

ether.browseUrl(PSTR("/mypage.php?"), gets, website, my_callback); // send it to the server
相关问题