I am trying to only access a webpage's returned status code but the page is proctected by a login process.
I already have the credentials but I cannot directly send http request and see the status code because it returns HTML of login page.
I need to find a way such that when I send http request to that web service, it should go through those login process and return me only status code.
An advised way is that using scripted browser, but still even if I successfully login to that page and display it, how can I send status code to my local backend ?
If the logon process consists of just giving the correct username and password, you can "fake" it with a single request like
fetch("https://protected.page/login", {
method: "POST",
headers: {"content-type": "application/x-www-form-urlencoded"},
body: "username=you_know_it&password=you_know_it&submit=Logon"
}).then(response => response.status);
But if login involves one-time tokens or captchas, this is of course not sufficient.