Captive portal script

Help :grin:. Im trying to write script to auto login to our holiday site captive portal for when it logs the session out. Ive got the logic of the script working with the exception of the command to pass through the authentication. The site url does a redirect to get to the login page. Iā€™ve tried passing both urls and the script is erroring with the below. Ive tried the nubifi and hslocal urls. Where im i going wrong?
TIA

Access captive portal and login

        Response=$(curl -s -o /dev/null -w ā€œ%{http_code}ā€ -d ā€œusername=$USERNAME&password=$PASSWORDā€ ā€œ$CAPTIVE_PORTAL_URLā€)

-ash: 200.: not found
Mon Dec 16 16:48:24 WET 2024: Failed to log in to the captive portal. HTTP response code: 000

Redirecting ...
    <body onLoad="document.form1.submit();">

            Se estā–’ redirigiendo a la pā–’gina de login
            <form name="form1" action="http://portal.nubifi.com/ **********n.asp" method="post">
                    <input type="hidden" name="hostname" value="hslocal. Info">
                    <input type="hidden" name="identity" value="*************">
                    <input type="hidden" name="login-by" value="">
                    <input type="hidden" name="plain-passwd" value="no">
                    <input type="hidden" name="server-address" value="1.1.1.1:80">
                    <input type="hidden" name="server-name" value="18-FD-74-8C-xxxxxx">
                    <input type="hidden" name="ssl-login" value="no">
                    <input type="hidden" name="interface-name" value="BRIDGE-VLAN10">
                    <input type="hidden" name="link-login" value="http://hslocal.info/login">
                    <input type="hidden" name="link-login-only" value="http://hslocal.info/login">
                    <input type="hidden" name="link-login-plain" value="$(link-login-plain)">
                    <input type="hidden" name="link-logout" value="http://hslocal.info/logout">
                    <input type="hidden" name="link-status" value="http://hslocal.info/status">
                    <input type="hidden" name="link-orig" value="">
                    <input type="hidden" name="domain" value="">
                    <input type="hidden" name="ip" value="192.168.34.178">
                    <input type="hidden" name="logged-in" value="no">
                    <input type="hidden" name="mac" value="96:83:C4:06:xxxx">
                    <input type="hidden" name="trial" value="no">
                    <input type="hidden" name="username" value="">
                    <input type="hidden" name="idle-timeout" value="">
                    <input type="hidden" name="idle-timeout-secs" value="0">
                    <input type="hidden" name="limit-bytes-in" value="">
                    <input type="hidden" name="limit-bytes-out" value="">
                    <input type="hidden" name="refresh-timeout" value="">
                    <input type="hidden" name="refresh-timeout-secs" value="0">
                    <input type="hidden" name="session-timeout" value="">
                    <input type="hidden" name="session-timeout-secs" value="0">
                    <input type="hidden" name="session-time-left" value="">
                    <input type="hidden" name="session-time-left-secs" value="0">
                    <input type="hidden" name="uptime" value="0s">
                    <input type="hidden" name="uptime-secs" value="0">
                    <input type="hidden" name="session-id" value="">
                    <input type="hidden" name="var" value="">
                    <input type="hidden" name="error" value="">
                    <input type="hidden" name="error-orig" value="">
                    <input type="hidden" name="chap-id" value="\276">
                    <input type="hidden" name="chap-challenge" value="\114\260\370\270\077\072\057\161\134\077\131\126\226\300\375\362">
                    <input type="hidden" name="EjecutadoLogin" value="SI">




            </form>

    </body>
200. root@GL-MT300N-V2:/tmp/log# ^C

The script looks like you use the cURL to send a POST request with the username and password?

The HTTP response code of "000" seems to indicate that the request did not receive a valid HTTP response from the server.

It may be confirmed first whether this site supports this request.

BTW, if you connect to Portal WiFi, can the webpage be opened by requesting the HTTP(S) through the device/client?