[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: curl and form submission




On Wednesday 08 June 2016 05:01 PM, Jeremy Nicoll wrote:
On Wed, 8 Jun 2016, at 17:16, Bob wrote:

Well Tomas, I like to share with you that your guess is again correct.
This link quickly redirects to http://<linkk> (seems the session checked
here) and then to home page. I'm tying to figure out the cookie part now.
It's important that at the start of this process you have an empty
cookie file.  Then
you give its name to curl on every call; curl will store any cookies
that the site sends
to you in that file (you shouldn't have to pay any attention to what
they actually
are).  In every subsequent curl command, you again specify the same file
and the
cookies whose values are stored in it are sent back to the server by
curl.  Each time
the server might change cookies but the whole thing should just work.
At the very
end of the process, throw the cookie file away.

Also, in the curl command you can specify names of files into which curl
will place
the HTML of the page you just fetched, and you can sepcify a second file
to have the
headers (which accompany every page sent to a browser, but users don't
ever see
them) stored.  It's good to do this because those headers will include
any server
error codes - useful for diagnosing problems in the whole process - and
they also
contain eg redirection instructions, if the server wants you to make
another request
for a different page.  if you don't have the headers file for your
script to read and check
it can be really difficult to make this sort of thing work!

Hello Jeremy,

Thanks for your explanation. I did "curl -c" but no luck as it doesn't have any cookie.

curl -c mycookie " http://<link>/login1.html?a=%3F<username>%2B%2F%40&b=%3F<password>%2B%2F%40 "

# ls mycookie
ls: cannot access 'mycookie': No such file or directory

whereas I can see during curl operation

[....]

<body onload="load();">
<form name="myform" method="post" action="http://<link>/login">
<input type="hidden" name="username" />
<input type="hidden" name="password"/>
</form>
</body>

[/...]




Reply to: