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

Re: curl and form submission



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!

-- 
Jeremy Nicoll - my opinions are my own.


Reply to: