How to read a file hosted on website?

kian79
Posts: 28
Joined: Thu Jun 13, 2019 3:27 am

How to read a file hosted on website?

Postby kian79 » Sun Jul 05, 2020 11:31 am

Hi all,

I would like to work on a project where I can use the ESP32 to connect to a website and download a .h file (containing a large image array) to be displayed on a TFT LCD.

I don't have much idea on how to get started. I am able to interface the ESP32 to the TFT LCD and I can display an image properly by hardcoding the image array into my Arduino program.

Is it possible for that I have a .h file hosted on a website and have the ESP32 use HTTP post to download and stream the array? How can I do it? If would be great if there is an example code that I can refer to.

Thank you.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: How to read a file hosted on website?

Postby PeterR » Sun Jul 05, 2020 1:13 pm

You could use HTTP POST to read an image, the image would have to be returned in the post response. You might have problems with the size of the response though & you would have to code the POST response on the server.

The proper approach is to use HTTP GET to, err, get an item using the HTTP protocol. HTTP GET would allow you to fetch any object from a server. Typically file based server objects would be automatically returned & would not need any special server side code.

The examples directory has many HTTP client examples. Your ESP would be a client of your image server.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: dssman and 79 guests