Path: csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!aioe.org!yBIfwlcYvPp0VbqA9SeaOg.user.46.165.242.75.POSTED!not-for-mail From: Kevin Wells Newsgroups: comp.sys.acorn.programmer Subject: Re: Accessing a password-protected page via wget Date: Fri, 21 Jan 2022 16:54:24 GMT Organization: Aioe.org NNTP Server Lines: 85 Message-ID: <05f75aae59.Kevin@Kevsoft> References: Injection-Info: gioia.aioe.org; logging-data="7562"; posting-host="yBIfwlcYvPp0VbqA9SeaOg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Messenger-Pro/8.05wpb1 (MsgServe/8.05) (RISC-OS/5.29) NewsHound/v1.52-32 X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.sys.acorn.programmer:6318 In message Harriet Bazley 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: > >
Sorry, you don't have permission to access the page you were trying to reach. Please log in.
> > >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 > >
>
>
>
>
>
>
Submit
>
> >
> >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,