Using Ethercard library to send HTTP GET with request headers

4k Views Asked by At

I am trying to interface an arduino with a modem using ENC28J60. I wrote my code and I am able to browse url using ether.browseUrl()

ether.browseUrl(PSTR("/statsadsl.html"), "", website, browseUrlCallback1);

I used the above shown line in order to retrieve data from that page.

Now I need to include request headers with this link. I don't have much knowledge in TCP/IP and HTML. However I need to send this HTTP GET with request header as "Connection: keep-alive". I need some help from here. I contacted avrfreaks and arduino forums for similar doubts. I don't get much reply. I hope I will get some useful information from here.

All types of information are welcome. Thanks a lot in advance for any help/info.

1

There are 1 best solutions below

2
On

in my project i use DHT22 to read humidity, temperature and send it to my webpage. presume, i've already read and prepare everything and i am rdy to send it to 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