H
H
hrvasiliy2014-09-11 23:00:13
PHP
hrvasiliy, 2014-09-11 23:00:13

How to pass cookies in the second request?

There is a parser that passes authorization through the curl_setopt parameter and writes a cookie file to the server. How to pass these cookies to further parser requests? (in order to parse already logged in, I won't parse the login page...)
It would be great if you could attach an example to the answer...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2014-09-24
@rdifb0

All parser requests (or rather, cUrl initializations) must have options, and it will write / read cookies itself.

curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); // Из какого файла читать
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); // В какой файл записывать

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question