logo elektroda
logo elektroda
X
logo elektroda

Reading a value into a variable from the url (webserver and esp8266)

samolot123456747 789 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18800260
    samolot123456747
    Level 3  
    I'm looking for an option so that when I type in, for example, 111.111.111/on:50, the number 50 goes from a variable(the link formula may look different, but what's important to me is that any number entered in place of 50 is taken to a variable). I can't find this anywhere, I don't know why, maybe I've been looking wrong. (I am doing everything on the ESP8266WiFi.h DNSServer.h libraries ESP8266WebServer.h WiFiManager.h on arudino esp8266 )

    Please help me a lot and thank you in advance.

    PS. for embracing the http server in general I used this: https://randomnerdtutorials.com/wifimanager-w...-parameter-and-manage-your-ssid-and-password/ (the first code, not the second).
    In this video something like this has been done, but I don't know how to interpret it, so I would ask possibly to clean up the code and leave the script itself concerning such data retrieval with a detailed explanation: https://www.youtube.com/watch?v=XuAw4IDy_0A&t=265s

    If I have chosen the wrong forum then please feel free to move.
  • ADVERTISEMENT
  • #2 18800356
    JacekCz
    Level 42  
    A more orthodox notation would be:

    111.111.111?on=50

    And that 'on' would be the name of the GET variable and '50' its value.
    And especially as you use a colon, it wakes up my flashing orange light.

    Unfortunately, in view of the multitude of "libraries" with the same name, I can't help as to the guts of their code
  • ADVERTISEMENT
  • #3 18800403
    samolot123456747
    Level 3  
    Ok, that works for me. It can be on other libraries-I'll accommodate. Do you happen to have a link to a tutorial?
  • #4 18800469
    JacekCz
    Level 42  
    You give full links of the aforementioned libraries, then maybe something can be analysed and hinted at.
    Unfortunately but e.g. the ESP8266WiFi "blibliotek" is at least 10.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #6 18800588
    JacekCz
    Level 42  
    At 66%, I would say that the "library" you previously used should also have HTTP call argument chunking. This is how it has intuition.

    I'd suggest deepening your knowledge of the specific reaslocation, including the most basic: reading that library especially the server class (that's in arduino akurat are not alarming amounts of code) - rather than jumping from flower to flower based on the chaos that google renders.
  • #7 18800612
    samolot123456747
    Level 3  
    Thank you for your advice, I will definitely take it :) .

Topic summary

The discussion revolves around retrieving a variable value from a URL using the ESP8266 microcontroller. The original poster seeks a method to extract a number from a URL formatted as "111.111.111/on:50". A suggestion is made to use a more standard format, "111.111.111?on=50", where "on" is the GET variable name and "50" is its value. The conversation includes requests for tutorials and links to relevant resources, including a YouTube video and a GitHub code repository. Participants emphasize the importance of understanding the libraries used, particularly the ESP8266WiFi, DNSServer, and ESP8266WebServer libraries, to effectively implement the desired functionality.
Summary generated by the language model.
ADVERTISEMENT