HTTPPOST problem



  • why if i use the browser and this path "http://192.168.1.123/?offx" it work (it is a IOT device), if i use the following program it those not work?

    0_1610725141559_Schermata 2021-01-15 alle 16.30.04.png



  • if the url is www.google.com i get the html text of the site

    this is the server response that i not able to get as result

    0_1610734749783_Schermata 2021-01-15 alle 18.06.48.png



  • Are you sure you want to do a POST request in your code and not GET?



  • I tested both, i don’t get the espected result



  • Your flow works for me using https://httpbin.org/get as a test server for HTTP GET. Also it works for HTTP POST, but I added a key/value pair to pass along with the POST Data, like this...

    0_1611257442757_Screen Shot 2021-01-21 at 2.28.52 PM.png

    If you would like further help troubleshooting, you'll need to provide more detail...

    • What M5 hardware and software version (uiFlow and device firmware) are you using?

    • What the 192.168.1.123 device is (you mentioned IOT device, but what is it?) and also what the ?offx query string is for (i.e. what does it do or what do you expect from it?)



  • @world101 i use m5stick, last update, uiflow last update.
    about the device, it is a hw that work as e web server, to comunicate to it you send a Httppost http://ip.../ the command, as it receive the command it respond.

    Try yourself use a browser:


    http://79.8.125.79:8084/?onx

    it respond:
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
    ua 1 ub 1 uc 1 ud 1 ue 1 uf 1 ug 1 uh 1 ui 1 ul 1
    </body>
    </html>


    try
    http://79.8.125.79:8084/?offx

    it respond:
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
    ua 0 ub 0 uc 0 ud 0 ue 0 uf 0 ug 0 uh 0 ui 0 ul 0
    </body>
    </html>


    In the body i get the Port ua 1 or 0, etc etc

    i tested using esp32 and arduino.app and it work.
    I don't understand how to use UiFlow standard command. i like it and i understood most of the sintax but in this case i don't.
    it look simple but it doen't work.



  • @world101 the urlwork using firefox, for security reason chrome doesn't work.



  • @world101 i use mac and the browser Safari give me a different error:
    "Cancelled load from 'http:79.8.125.79:84/?onx' because it is using HTTP/0.9" (:0)

    HTTP/0.9 is the problem?



  • @world101 Locally it work with any browser.



  • @franco
    I'm in the US and I get a connection timeout to 79.8.125.79:8084, so I'm not able to test with that.

    Can you add a "Get Status Code" block to your flow and print to the serial console or the M5StickC screen what HTTP status code you get back? Something like this...

    0_1611610080761_Screen Shot 2021-01-25 at 4.26.47 PM.png



  • As i told you from wan it work only firefox and i don’t understand why.
    I will do tomorrow the add you are suggesting then i will tell you.
    Thank you very much



  • Just wanted to provide an update on this topic. I too am having issues with HTTP POST to an endpoint on my local network. I'm trying to program a simple on/off remote button for my Hyperion ambient lighting setup that is behind my TV. This is my flow...

    0_1612103278676_Screen Shot 2021-01-31 at 9.26.56 AM.png

    First I need to switch to an instance before I can send the on/off command. When I press button A on the M5StickC, it completely locks up the device during the HTTP POST command. I cannot even short press the power button to reset it. I have to hold down the power button for 6 seconds to fully power it off, then I can power it on again. Same exact thing with the M5StickC+. The M5Fire is a little better. It doesn't lock up, but I still can't get the HTTP POST to be a success or a fail. I would expect some type of failure if it didn't work properly... but instead I get nothing.

    I'll continue to troubleshoot. It might be due to the IP:port in the HTTP request, as my test with https://httpbin.org/post works fine and it doesn't use a port. I'll let you know if I figure anything out.