LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   wget to login to a website (https://www.linuxquestions.org/questions/linux-general-1/wget-to-login-to-a-website-659026/)

uks 07-29-2008 10:24 AM

wget to login to a website
 
Hi All,

I am trying to login to a website using wget like this:

wget --save-cookies=cookie.txt --post-data "Login Id=test&password=xxx" http://url

and I get the contents of the login screen and not the screen after that. I do not even know if it has logged in.

I used "Login Id=" because thats the name of that field in the page.

I also tried

wget -d --http-user=test --http-passwd=xxx http://url

and I get the same page.

I want to

a) ensure that I am logged in
b) get the page post login.

Any help is greatly appreciated.

Rgds,

Uks

blacky_5251 07-29-2008 11:12 PM

Have you tried something like this?:-
Code:

wget --user=xxxx --password=xxxx http://url

uks 07-30-2008 02:39 AM

Hi Ian,

password or passwd is not recognized.
Says, wget:unrecognized option '--password=xxxx'

Rgds

Uks

blacky_5251 07-30-2008 06:10 AM

Your version of wget must be different to mine then, because I use --user=xxx and --password=xxx in scripts regularly. I'm running on CentOS 5.2 with the following wget version:-
Code:

2.6.18-92.1.6.el5.centos.plusxen[root@www ~]# wget --version
GNU Wget 1.10.2 (Red Hat modified)

Copyright (C) 2005 Free Software Foundation, Inc.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
2.6.18-92.1.6.el5.centos.plusxen[root@www ~]#


uks 07-31-2008 03:18 AM

I am trying to install that version, Ian. And I am stuck with the library files....its giveing me a hard time.
I will let you know once I am done installing.

uks 08-06-2008 05:05 AM

No, that does not help me either.
The output of wget <url> and wget --user=xxxx --password=xxxx http://url
appears to be the same.
Anything else I could try ?

elronx 11-01-2012 04:44 AM

Login using cookies
 
I've faced with the same issue and could not login with --user and --password parameters. But I have managed to login and download the site using cookies.

What I've done is;

- Clear all the cookies of browser
- Login to the page that I want to download
- After successful login, export cookies to a file (cookies.txt)
- For Firefox, you can use "Export Cookies" plugin for exporting.
- wget --load-cookies=cookies.txt [other options ...]


All times are GMT -5. The time now is 11:32 AM.