U
U
Us592019-12-23 21:24:33
Parsing
Us59, 2019-12-23 21:24:33

How to get and use cookies?

I make a curl request to the site, to a specific url address, but it gives an error if my cookies are empty. Having made a request a second time to the same url, it gives a normal response, because cookies are already there (if I wrote them down)
Of course, it’s not difficult for me to make an extra request to the site in order to first get cookies, and then access the desired url and get the necessary data. BUT!! The bottom line is that an extra request is a waste of time, and most importantly, in a multi-threaded mode, this will affect and decrease the efficiency.
Question: What is the best way to proceed in this case?
1) do not take a steam bath and first make a request to receive cookies for each request.
2) write cookies 1 time and take them as a basis, and write new cookies that I receive separately in cookie_id_order?
* Let me explain, cookies are not written just like that, the server gives me a task, then I send him a response, he identifies by cookies and checks my answer, so for each order I make a cookie_id_order i.e. unique file.
* Again, many questions arise, most likely cookies have a lifetime, how to find out how long they will live in order to set up auto-updating of cookies?)
3) Your option :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-12-23
@dimonchik2013

cookie JAR

P
prishelec, 2019-12-24
@prishelec

First request, cookies received
Second request already with new cookies (from the first)
Third request, cookies from the second
, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question