Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By JimDrew
#52060 The subject says it all. How can you get a binary file from a website? I need to download a small file that is an encryption key. I have tried various forms of GET /, but it seems that this is for use with HTML style headers, not binary data.

Any examples? Thanks!
User avatar
By eduperez
#52089 Even if you are asking the server for a binary file, there is always some HTTP headers added to the answer; you can find more info about the HTTP protocol here: https://www.ntu.edu.sg/home/ehchua/programming/webprogramming/HTTP_Basics.html.

If you do not want to write a full HTTP parser, I guess you can check the status code on the first bytes of the answer ("HTTP/1.1 200 OK") and then skip until you encounter an empty line.

See the "Testing HTTP Requests" > "Telnet" section in that document to see how you can debug from a computer what the server is sending to your ESP.
User avatar
By JimDrew
#52124 Thanks... this information is really helpful for those (like me) that don't know anything about how GET and POST work.

I can just parse the HTTP data and look for the blank line to start my binary read.