Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-10-2009, 10:59 PM   #1
Registered: Jun 2008
Posts: 56

Rep: Reputation: 15
Attempting to record the redirect url using wget and logging in in seperate page


My friend has a website whereby once you have logged in on one page, you are redirected to another page, with a url similar to:

the random string changes each time you log in, however the login page has a static url

What i was attempting to do is run a script to get some data from the members page (after uve logged in) - however ive been having some trouble in how to do this, as the variable url with the random string will become invalid after a certain time, and i did not want to consantly change it.

While reading through some documentation i read that wget should be able to login to a form login website however ive had no luck, the command i was attempting to use was:

wget --user USERNAME -password PASSWORD ""

similarly i also tried

wget --post-data "username=USERNAME&password=PASSWORD" ""

and even both combined. However neither has worked as the html dl'd is simply the login page website.

I cannot post a direct link to the website as it is private, however ive looked at the source coding and ive extracted (what i think) is the relevant bit, which is:

            <form action="/cgi-bin/sblogin/login.cgi" method="post" name="login" id="login"><br /><br />
                <div class="user_text"><span class="text3">USERNAME:</span></div><div class="user_box"><input type="text" class="text" name="uname"></div>  
                <div class="pass_text"><span class="text3">PASSWORD:</span></div><div class="pass_box"><input type="password" class="text" name="pword"></div>       
                <div class="text3" style="padding-left: 40px;">Save My Password<input name="savepassword" type="checkbox" checked /></div>
any help would be greatly appreciated.

Old 02-11-2009, 05:33 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Looks like you want
wget --post-data "uname=USERNAME&pword=PASSWORD" ""
These are the names of the form elements in the HTML code you have posted.

--- rod.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i wget a url with spaces xmrkite Linux - Software 7 12-21-2007 01:15 PM
redirect url munna_dude Linux - Software 2 02-15-2007 01:18 AM
url redirect Present Linux - Networking 4 01-26-2007 10:08 AM
wget missing url ergo_sum Linux - Newbie 2 06-07-2005 08:35 PM
wget url format Gilion Linux - Software 2 12-01-2003 09:26 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration