logo elektroda
logo elektroda
X
logo elektroda

NodeMcu - how do I upload a variable from a web page to NodeMcu?

globalinfo 3270 2
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15609760
    globalinfo
    Level 13  
    Welcome,

    I have a script on a website that when executed displays the value of $wyslij.
    Code: PHP
    Log in, to see the code

    On the NodeMc I have the program uploaded (via the Arduino IDE):
    Code: C / C++
    Log in, to see the code


    After execution, it displays the result to me on the serial monitor.
    Quote:

    [HTTP] connection closed or file end.
    [HTTP] begin...
    [HTTP] GET...
    [HTTP] GET... code: 200
    8
    deactivate


    0


    [HTTP] connection closed or file end.

    I would like to extract the value of $send that was sent. :idea:
    Can you help how to complete the program on NodeMcu.
  • ADVERTISEMENT
  • #2 15646289
    lukaszrzepinski
    Level 10  
    this example should help you (use string.find and insert a constant element in $wyslij, e.g. $wyslij="result:XXXX", and in string.find you search for "result:")

    Code: Lua
    Log in, to see the code
  • #3 16327091
    globalinfo
    Level 13  
    I changed this code a little bit but somehow it cuts off the name of the fan variable by one letter - I read it in this loop
    Code: C / C++
    Log in, to see the code

    Result on serial monitor
    Quote:
    [HTTP] begin...
    [HTTP] GET...
    [HTTP] GET... code: 200
    16
    fan=on&temp=7&wil=9
    0

    0

    an=on&temp=7&wil=9

    code reading the downloaded data
    Code: C / C++
    Log in, to see the code
ADVERTISEMENT