I have to login to a page using three parameters, after that I have to POST two parameters to another page inside the site I've just logged in.
So far I've got a cookie with this:
curl -c cookie.txt -d "username=username&pwd=pwd&domain=mydomain" http://myurl
...inside of the cookie I have a JSESSION id. I use the cookie as follows:
curl -b cookie.txt -d "par=value" http://myurlnumbertwo
Problems:
- even after a POST to the login url I get in the console the HTML code of the login page, does this mean that the login did not succeed? How can I find the error that caused this, maybe a log?
- after a successful login how do I remain in the login session and POST my parameters to the other page?
EDIT:
I finally got this working after stran's hint, follows the code.
- POST_DATA contains the exact encoded string that was posted, as in 'parameter1=value1¶meter2=value2'
- ACTION_URL contains the full URL to which the form is posted, as in http://stackoverflow.com/users/login
First I did a
wget --save-cookie cookie.txt --post-data 'POST_DATA' ACTION_URL
to make the login and save the cookie, followed by a:
wget --load-cookie cookie.txt --post-data 'POST_DATA' ACTION_URL
to make the POST I needed, thank you again for the hint ^^