Save variables on a www server, for using it on my ESP8266

Hey falks,

how can I save variables on a web-server, and than use it on my ESP8266 Server ?

I will explain it in detail:

I wanna create a .txt-file, with this following content:

integer1=expample,integer2=anotherExample

And than, my ESP8266 which has acces to the internet, will read the txt-file, and convert it to an integer which I can use on my ESP8266.

I hope, I could explain this.

what protocol is available on your web server ?

for example:

  • if you have a full HTTP service on the server and the file lives in a place where you can access it, a simple GET request with the URL will let you access the content of the file. Then it's a matter of parsing the content of that file. Saving the variables would just be using a text editor on the server side and create/update the file. Alternatively the client could also send a request to an application running on the server to create/update the file (a python or PHP script for example)

  • if you have a full FTP service, then through an FTP library you could download or upload a file to the server

there are tons of other options

1 Like

thanks man, but how can I do this ? my aim is to have a serial output. it is a http server.

what's your programming skill level?

you could start by studying examples making GET requests, here is a first google hit

1 Like

I am not a beginner, but also not a prof. But your example looks great. thanks man.

explore. You can always come back if you have specific questions, the forum is here to help out (just make sure you post all the details of your code (using code tags) and describe your circuit)

1 Like

okay man. I will try and if it works, I will inform you. greetings from Bielefeld, Germany

Heay man, I really really thank you. It works well. Here is what I did:

I uploaded a simple text file, with the following contet: testvariables

and if I run the first code (GET-METHOD), that the output of the Serial is indeed: testvariables

I really really have to thank you man :smiley:

One question I still have though:

this first method (ESP8266 HTTP GET: Value or Query in URL), does it consume too much energy from the chip ? Or is it save to use it.

And secondly: does this method consume flash meomry at all ? And if yes, how much ?

well you activate the wifi layer so it does draw some current - way more than when idle of course. there are articles on line talking about this (an example)

it uses only the flash memory you see at compile time. There is RAM involved of course

1 Like

Hey man, you saved my whole week :slight_smile:

I've been coding and programming my SmartHome, with Sinric and other Smart-IOT-Providers. Because of you, I've my own Smart-IOT-Cloud. Thanks man. The only thing I have to do now, is: register a power WebspaceProvider, like GoDaddy, or Ionos (Germany).

Greetings from Germany man !!! You saved my week, not day.

happy if that was helpful
have fun !

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.