LinuxQuestions.org

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

itlogy 05-18-2012 01:14 AM

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

Babertje 05-18-2012 02:55 AM

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

itlogy 05-18-2012 03:20 AM

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,

itlogy 05-19-2012 01:28 AM

Hi, can any body help me please....

Dafydd 05-19-2012 02:12 AM

Please Post your complete command line.

Dafydd 05-19-2012 02:18 AM

Have you googled ' "wget "error 302" ' without the single quote.

jefro 05-19-2012 02:07 PM

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.

itlogy 05-19-2012 07:24 PM

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

Dafydd 05-19-2012 08:43 PM

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.

Dafydd 05-19-2012 08:45 PM

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]


Dafydd 05-19-2012 08:53 PM

That page asks for your email and password. Why, if I may ask, don't you just go there and view your account information?

itlogy 05-19-2012 09:10 PM

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.

Dafydd 05-19-2012 11:15 PM

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

chrism01 05-21-2012 08:34 PM

Have you considered Perl using the WWW::Mechanize module http://search.cpan.org/~mstrout/WWW-...W/Mechanize.pm

itlogy 05-22-2012 01:45 PM

I have no idea on how to write code in Perl. Appreciate if you could help.


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