LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

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


Hi,

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:

http://sbf74jf84.url.com

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 "http://url.com"

similarly i also tried

wget --post-data "username=USERNAME&password=PASSWORD" "http://url.com"

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:

Code:
            <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.

Thankyou.
 
Old 02-11-2009, 04:33 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

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

--- rod.
 
  


Reply


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 12:15 PM
redirect url munna_dude Linux - Software 2 02-15-2007 12:18 AM
url redirect Present Linux - Networking 4 01-26-2007 09:08 AM
wget missing url ergo_sum Linux - Newbie 2 06-07-2005 07:35 PM
wget url format Gilion Linux - Software 2 12-01-2003 08:26 AM


All times are GMT -5. The time now is 11:38 PM.

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