Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6318

Re: Accessing a password-protected page via wget

From Kevin Wells <kev@kevsoft.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Accessing a password-protected page via wget
Date 2022-01-21 16:54 +0000
Organization Aioe.org NNTP Server
Message-ID <05f75aae59.Kevin@Kevsoft> (permalink)
References <dd8749ae59.harriet@bazleyfamily.co.uk>

Show all headers | View raw


In message <dd8749ae59.harriet@bazleyfamily.co.uk>
          Harriet Bazley <harriet@bazleyfamily.co.uk> wrote:

>I've been trying to use wget to retrieve a page that is only accessible
>to logged-in users (user stats - so that I can analyse them and keep a
>running record of changes).
>Basically, I can't seem to get the correct syntax for the site to
>receive/recognise my name and password in the first place, let alone to
>serve up the stats page requested....
>
>
>I don't really know how to use the relevant features of
>wget and have been flailing around rather at random.  Simply using

If you use the -S option you get the server response, which if used woth
the -o option you can then save it and see what the server is saying.
>
>wget --ask-password STATS_URL
>
>doesn't produce the desired result; it prompts for the password all
>right, but when I supply it the fetch then gets redirected to retrieve
>the log-in page instead, just as if I had supplied no password or the
>wrong one.
>
>wget --user=USERNAME --ask-password STATS_URL
>
>prompts "Password for user" instead of just "Password", but still
>doesn't seem to pass the required data.
>
>Same result from
>
>wget --user=USERNAME --password=PASS STATS_URL
>
>(the retrieved page states 'sorry, you don't have access to view the
>page you were trying to reach, please log in')
>
>
>After looking for advice on the Web I tried fetching the log-in page
>directly using the same methods and using --keep-session-cookies before
>running a second command to fetch the stats page immediately afterwards,
>but that didn't work.  It fetches the login page, then redirects and
>fetches it again under a different name, the only difference being the
>error:
>
><div class="flash error">Sorry, you don&#39;t have permission to access the page you were trying to reach. Please log in.</div>
>
>
>I then tried using --save-cookies followed by --load-cookies for the
>second request, but that didn't work, doubtless because the resulting
>'cookies' file had no content:
>
># HTTP cookie file.
># Generated by Wget on 2022-01-21 13:37:33.
># Edit at your own risk.
>
>
>I then tried
>
>wget --post-data 'user_login=USERNAME&user_password=PASS' LOGIN_URL
>
>where the relevant form reads
>
><dt><label for="user_login">User name or email:</label></dt>
>    <dd><input type="text" name="user[login]" id="user_login"/></dd>
>    <dt><label for="user_password">Password:</label></dt>
>    <dd><input type="password" name="user[password]" id="user_password"/></dd>
>    <dt><label for="user_remember_me">Remember me</label></dt>
>    <dd><input name="user[remember_me]" type="hidden" value="0"/><input type="checkbox" value="1" name="user[remember_me]" id="user_remember_me"/></dd>
>    <dt class="landmark">Submit</dt>
>    <dd class="submit actions">
>      <input type="submit" name="commit" value="Log in" class="submit"/>
>    </dd>
>
>but still had no luck.
>
>I'm simply not managing to submit the name/password combination in any
>way that the site will acknowledge.
>


-- 
Kev Wells
http://kevsoft.co.uk/  https://ko-fi.com/kevsoft
carpe cervisium
I went into a theatre as sober as could be,

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing a password-protected page via wget Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-21 13:43 +0000
  Re: Accessing a password-protected page via wget Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-21 15:11 +0000
  Re: Accessing a password-protected page via wget Kevin Wells <kev@kevsoft.co.uk> - 2022-01-21 16:54 +0000
    Re: Accessing a password-protected page via wget Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-21 17:45 +0000
      Re: Accessing a password-protected page via wget Steve Fryatt <news@stevefryatt.org.uk> - 2022-01-21 18:57 +0000
        Re: Accessing a password-protected page via wget Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-21 20:28 +0000
  Re: Accessing a password-protected page via wget druck <news@druck.org.uk> - 2022-01-22 10:25 +0000
    Re: Accessing a password-protected page via wget Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-22 12:17 +0000

csiph-web