LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 05-18-2012, 01:14 AM   #1
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Rep: Reputation: Disabled
wget to login to an online website


Hi,

I am trying to login to an online site using wget. getting 302 error. Please help!!


login Page:
https://ssl.buy.com/AC/loginAccount....myaccount.aspx

download page:
https://ssl.buy.com/AC/myaccount.aspx

username: mytest@gmail.com
password: 20122012
 
Old 05-18-2012, 02:55 AM   #2
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
wget is to fetch pages to your local machine if you're looking for a text-based web-browser try lynx http://en.wikipedia.org/wiki/Lynx_(w...External_links
 
Old 05-18-2012, 03:20 AM   #3
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi Babertje, thanks for your responce. Yes, i am trying to download the page using wget. After that i will run a script to check my order status.

Thanks,
 
Old 05-19-2012, 01:28 AM   #4
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi, can any body help me please....
 
Old 05-19-2012, 02:12 AM   #5
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
Please Post your complete command line.
 
Old 05-19-2012, 02:18 AM   #6
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
Have you googled ' "wget "error 302" ' without the single quote.
 
Old 05-19-2012, 02:07 PM   #7
jefro
Guru
 
Registered: Mar 2008
Posts: 10,246

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
Site may know you are trying that and is blocking it. It is also an active page you posted. ..myaccount.aspx Unlikely to be saved across access.
 
Old 05-19-2012, 07:24 PM   #8
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi,

Here is full command line i am trying. I got the Cookie from firefox Cookies Manager Add on.

wget --no-check-certificate --span-hosts --header "Cookie: BuyComAuthAccountCookie=25A1585346202FB785702DD10A9C08079686A8077EE300C13206013EC379AB88F75AA859672A 1705258ECD3877862732C55A135807AA6BDD41CAE880E066BF7CD26020AAEA754D50EFA67989A1155E90B28D49AEA3691CE1 DE0901A8688771FD7C74ADBDE3701B526E87CE867BF8CD979495AF715635C40D0FAD92E9C9BB86C3" "https://ssl.buy.com/AC/myaccount.aspx"



C:\temp\buy>wget --no-check-certificate --span-hosts --header "Cookie: BuyComAut
hAccountCookie=25A1585346202FB785702DD10A9C08079686A8077EE300C13206013EC379AB88F
75AA859672A1705258ECD3877862732C55A135807AA6BDD41CAE880E066BF7CD26020AAEA754D50E
FA67989A1155E90B28D49AEA3691CE1DE0901A8688771FD7C74ADBDE3701B526E87CE867BF8CD979
495AF715635C40D0FAD92E9C9BB86C3" "https://ssl.buy.com/AC/myaccount.aspx"
--2012-05-19 17:20:27-- https://ssl.buy.com/AC/myaccount.aspx
Resolving ssl.buy.com... 209.67.181.23
Connecting to ssl.buy.com|209.67.181.23|:443... connected.
WARNING: cannot verify ssl.buy.com's certificate, issued by `/C=US/O=VeriSign, I
nc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c
)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 302 Found
Location: /AC/MyAccount.aspx [following]
.
.
.
.
.

--2012-05-19 17:20:32-- https://ssl.buy.com/AC/MyAccount.aspx
Connecting to ssl.buy.com|209.67.181.23|:443... connected.
WARNING: cannot verify ssl.buy.com's certificate, issued by `/C=US/O=VeriSign, I
nc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c
)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 302 Found
Location: /AC/MyAccount.aspx [following]
20 redirections exceeded.


wget --no-check-certificate --max-redirect=9999 --span-hosts --header "Cookie: BuyComAuthAccountCookie=25A1585346202FB785702DD10A9C08079686A8077EE300C13206013EC379AB88F75AA859672A 1705258ECD3877862732C55A135807AA6BDD41CAE880E066BF7CD26020AAEA754D50EFA67989A1155E90B28D49AEA3691CE1 DE0901A8688771FD7C74ADBDE3701B526E87CE867BF8CD979495AF715635C40D0FAD92E9C9BB86C3" "https://ssl.buy.com/AC/myaccount.aspx"

I also tried "--max-redirect=9999" still no luck. Even google didn't help me for 302 redirect issue. Same situation with Curl as well.

I really appreciate your help.

Thanks...
 
Old 05-19-2012, 08:43 PM   #9
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
Code:
wget --no-check-certificate --span-hosts --header "Cookie: BuyComAuthAccountCookie=25A1585346202FB785702DD10A9C08079686A8077EE300C13206013EC379AB88F75AA859672A 1705258ECD3877862732C55A135807AA6BDD41CAE880E066BF7CD26020AAEA754D50EFA67989A1155E90B28D49AEA3691CE1 DE0901A8688771FD7C74ADBDE3701B526E87CE867BF8CD979495AF715635C40D0FAD92E9C9BB86C3" "https://ssl.buy.com/AC/myaccount.aspx"
Worked just fine for me.
 
Old 05-19-2012, 08:45 PM   #10
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
Code:
dave@dave:~$ wget --no-check-certificate --span-hosts --header "Cookie: BuyComAuthAccountCookie=25A1585346202FB785702DD10A9C08079686A8077EE300C13206013EC379AB88F75AA859672A 1705258ECD3877862732C55A135807AA6BDD41CAE880E066BF7CD26020AAEA754D50EFA67989A1155E90B28D49AEA3691CE1 DE0901A8688771FD7C74ADBDE3701B526E87CE867BF8CD979495AF715635C40D0FAD92E9C9BB86C3" "https://ssl.buy.com/AC/myaccount.aspx"
--2012-05-19 20:37:31--  https://ssl.buy.com/AC/myaccount.aspx
Resolving ssl.buy.com... 209.67.181.23
Connecting to ssl.buy.com|209.67.181.23|:443... connected.
WARNING: cannot verify ssl.buy.com's certificate, issued by `/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 203451 (199K) [text/html]
Saving to: `myaccount.aspx'

100%[=============================================================================================================>] 203,451      539K/s   in 0.4s    

2012-05-19 20:37:32 (539 KB/s) - `myaccount.aspx' saved [203451/203451]
 
Old 05-19-2012, 08:53 PM   #11
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
That page asks for your email and password. Why, if I may ask, don't you just go there and view your account information?
 
Old 05-19-2012, 09:10 PM   #12
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi Dave,

Thanks for your response, i appreciate it. The reason of this script is to track the order status and integrate the result in another application for the company i am working for.

the command you ran, downloaded myaccount.aspx file but it is a login prompt page. If we provide right Cookie then it is leading to 302 redirect issue. i updated with right cookie which i got it from firefox cookie manager, below is the output.


C:\temp\buy>wget --no-check-certificate --span-hosts --header "Cookie: BuyComAut
hAccountCookie=ACC2261342FBD521CB6A78521FE308AE3DBABC71A5CF63125451B6C3ED69C63A5
A58D74F338925308249813E2365B85A30978EF75FF749205EEDDFEB5E77223848B4BCB6B45DEE371
B68123CC2B2FC4528DDD14FC697BAA6925C6563CA27B7023F926242A0ECB357807EB5AEA05F7BF81
B0B87D3125A694F3D4A406B6D25FBA3" "https://ssl.buy.com/AC/myaccount.aspx"
--2012-05-19 19:06:29-- https://ssl.buy.com/AC/myaccount.aspx
Resolving ssl.buy.com... 209.67.181.23
Connecting to ssl.buy.com|209.67.181.23|:443... connected.
WARNING: cannot verify ssl.buy.com's certificate, issued by `/C=US/O=VeriSign, I
nc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c
)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 302 Found
Location: /AC/MyAccount.aspx [following]
.
.
.
--2012-05-19 19:06:33-- https://ssl.buy.com/AC/MyAccount.aspx
Connecting to ssl.buy.com|209.67.181.23|:443... connected.
WARNING: cannot verify ssl.buy.com's certificate, issued by `/C=US/O=VeriSign, I
nc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c
)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 302 Found
Location: /AC/MyAccount.aspx [following]
20 redirections exceeded.
 
Old 05-19-2012, 11:15 PM   #13
Dafydd
Member
 
Registered: Oct 2008
Posts: 290

Rep: Reputation: 22
Code:
dave@dave:~$ wget --no-check-certificate --span-hosts --header "Cookie: BuyComAut
>  hAccountCookie=ACC2261342FBD521CB6A78521FE308AE3DBABC71A5CF63125451B6C3ED69C63A5
>  A58D74F338925308249813E2365B85A30978EF75FF749205EEDDFEB5E77223848B4BCB6B45DEE371
>  B68123CC2B2FC4528DDD14FC697BAA6925C6563CA27B7023F926242A0ECB357807EB5AEA05F7BF81
>  B0B87D3125A694F3D4A406B6D25FBA3" "https://ssl.buy.com/AC/myaccount.aspx"
wget: --header: Invalid header `Cookie: BuyComAut\n hAccountCookie=ACC2261342FBD521CB6A78521FE308AE3DBABC71A5CF63125451B6C3ED69C63A5\n A58D74F338925308249813E2365B85A30978EF75FF749205EEDDFEB5E77223848B4BCB6B45DEE371\n B68123CC2B2FC4528DDD14FC697BAA6925C6563CA27B7023F926242A0ECB357807EB5AEA05F7BF81\n B0B87D3125A694F3D4A406B6D25FBA3'.
dave@dave:~$
I get a different error.

Have you tried contacting the website and seeing if there are hook you can access or if there is a email they can send with the information you require?

D
 
Old 05-21-2012, 08:34 PM   #14
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994Reputation: 1994
Have you considered Perl using the WWW::Mechanize module http://search.cpan.org/~mstrout/WWW-...W/Mechanize.pm
 
Old 05-22-2012, 01:45 PM   #15
itlogy
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
I have no idea on how to write code in Perl. Appreciate if you could help.
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wget to login to a website uks Linux - General 6 11-01-2012 04:44 AM
wget through an authenticated website davee Linux - Networking 2 02-11-2009 04:57 AM
Using wget to test if a website is up ericcarlson Linux - Software 3 10-14-2008 08:36 AM
using wget to download all videos from a website fakie_flip Linux - Software 3 08-16-2006 05:02 AM
wget - retrieving one folder of website davidhayter Linux - Software 4 03-07-2005 08:20 PM


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

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