使用Ethercard库发送带请求标头的HTTP GET
问题描述:
我正尝试使用ENC28J60将调制解调器与arduino连接。我写我的代码和我能够浏览使用ether.browseUrl()使用Ethercard库发送带请求标头的HTTP GET
ether.browseUrl(PSTR("/statsadsl.html"), "", website, browseUrlCallback1);
网址我使用上述所示线,以从该页面检索数据。
现在我需要包含请求标题与此链接。我对TCP/IP和HTML没有太多的知识。不过,我需要发送这个带请求头的HTTP GET作为“Connection:keep-alive”。我需要从这里得到一些帮助。我联系了avrfreaks和arduino论坛,提出了类似的疑问。我没有得到太多答复。我希望我能从这里得到一些有用的信息。
欢迎各种类型的信息。提前感谢您提供任何帮助/信息。
答
在我的项目中,我使用DHT22读取湿度,温度并将其发送到我的网页。 推测,我已经阅读并准备好了一切,并且我rdy将它发送到web ...
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
什么是'my_callback'? – Jim