Page 1 of 1

cURL question

Posted: Wed Aug 04, 2004 8:45 am
by Oxydude
I am trying to use curl to access a webpage. When I try to get information about a particulat item:

curl http://catalog.bigcompany.com/cgi-bin/c ... a=chair123

it redirects me to a login website and returns the following:

The document has moved <A HREF="/noauth/bclogin.php?return=/cgi-bin/catalog?va=chair123">here</A>.<P>

From the source code for the form, the table information is:
<input type=text name=usermail "myemail@domain.com">
<input type=password name=userpass value="pass123">
<input type=hidden name=nocookies value="")
<input type=hidden name=enterkey value="hit")
<input type=submit name=userlogin value="login")

When this is entered through a webpage, the next page served is the chair123 page after I enter my name and password.

I just want to use curl from the command line to achieve this; first manually and then to integrate the command into my script.

Any ideas on how to do this?

Posted: Wed Aug 04, 2004 9:30 am
by hedge
You have to use curl to go to the login page, capture the session cookie sent back to you and then send it along with any subsequent requests.

I've never used curl so I don't know the mechanics, I've done it the hard way using fsockopen.

Posted: Wed Aug 04, 2004 9:39 am
by Oxydude
Thanks hedge, I will give it a shot!

Hedge

Posted: Wed Aug 04, 2004 3:31 pm
by Oxydude
Hedge,

I found something you wrote in March that I will try tonight:


viewtopic.php?t=7063

I think this is exactly what will work.

Thanks!

Posted: Wed Aug 04, 2004 7:43 pm
by hedge
From what I understand I did it the hard way. You may want to look at snoopy (source forge) or continue with CURL.

Posted: Wed Aug 04, 2004 7:58 pm
by Oxydude
I will look into snoopy. Thanks for the tip.