Some problems on using TCP socket

Hi @karimhamdy1
How are you? I always appreciate your advice and guide.

I’m trying to send wifi credentials from web browser to ESP32.
I followed Mini Web Server example provided by Zerynth.
I updated the response web page using form as follows.

str = "<html><body>"
str = str + "<h2>WiFi Credentials</h2><p>Enter your local WiFi network credentials in the form below.</p>"
str = str + "<form action = '/result' method='POST'>"
str = str + "<label for='ssid'>Ssid:</label><br>"
str = str + "<input type='text' id='ssid' name='ssid' value=''><br>"
str = str + "<label for='password'>Password:</label><br>"
str = str + "<input type='text' id='password' name='password' value=''><br><br>"
str = str + "<input type='submit' value='Submit'>"
str = str + "</form>"
str = str + "<p>Click Submit button to send the credentials to the Dtects Pi server.</p>"
str = str + "</body><html>"  

When I typed the server IP on web browser, the following page appears.


What I want right now is to get SSID and password entered in the form in Zerynth code.
When I click “submit” button, how can I get the them in the code? Or is it not possible to implement it using a TCP socket like in mini web server example? I think I need to make APIs for get and post requests, but I’m not sure how to do that in Zerynth.
My final goal is to send wifi credentials to ESP32 working as an AP using pc or phone web browser. Google has many similar illustrative codes and applications that use ArduinoIDE or microPython. However, I want to implement it in Zerynth.
Could you please let me know the best solution for it? I want you to provide similar cases or guidelines to do that.

Thanks in advance.

I think you can follow this tutorial,
make some GET requests with the value of the textboxes and parse them using the client.readline() when you receive the request.

Hi @karimhamdy1
Thanks for your reply.

The article you sent seems to be an C code example using Arduino IDE, not Zerynth.
I need to realize it in python code in Zerynth.

Thanks in advance.

Hi @karimhamdy1
Could you please respond me?
I’m waiting for your help.

I found a good solution for my problem.
Thanks for your help