Hi All,
To access my internet i need to authenticate with my internet provider.
Previously I would execute the following CURL script.
SET FON_USERNAME=xxxxxx
SET FON_PASSWORD=yyyyyy
SET FON_DELAY_UP=3
SET POST_URL=/noswifi?“hmac=123c5569fb349830771ed809006c67f6bdba6210c2886ebcb3077422d06b3b66&res=notyet&uamip=192.168.3.1&uamport=80&userurl=&challenge=3d8b9f3a23335437e18afb6a90a0f04b&nasid=0C-47-3D-0C-A6-85&mac=98-3B-8F-75-FD-05
SET DOMAIN_URL=https://captiveportal.nos.pt
SET DEVICE=”"
curl --insecure --location --header "content-type: “content-type: application/x-www-form-urlencoded” --data “userFake=%FON_USERNAME%&UserName=NOS/%FON_USERNAME%&Password=%FON_PASSWORD%&rememberMe=true&_ememberMe=on” %DOMAIN_URL%%POST_URL%
I’m trying to convert this to a mikrotik script using multiple fetch.
When I execute my first fetch i get the following :
[admin@MikroTik] > /tool fetch url=“http://www.osnews.com”
status: failed
failure: closing connection: <302 Redirect “https://captiveportal.nos.pt/noswifi?hmac=6dd741d0bf9f73e182bc130dde63a0e4889db22811f039d592df9c3e5799a0c1&res=
notyet&uamip=192.168.3.1&uamport=80&userurl=&challenge=3d8b9f3a23335437e18afb6a90a0f04b&nasid=0C-47-3D-0C-A6-85&mac=48-8F-5A-9A-5D-DE”> 35.221.46.9:80 (4)
My fist problem comes after invoking this fetch.
How can I check the return code and the redirect url ?
Fetch doesn’t return nothing if i try to return to a variable or to output to a file ( output=user as-value or output=file ).
Is it my impression or we are no able to parse the return from fetch unless the response is 200 and get some html back ?
In my case i need to be able to get to know that i need to authenticate to a different url, therefore it’s crucial that i’m able to parse the response even if it’s a error code.
regards
Luis Meira