E
E
Evgeny Fedorov2014-02-10 20:25:06
PHP
Evgeny Fedorov, 2014-02-10 20:25:06

Why does PHP curl re-save incorrect cookies to a file?

I write like this

curlt_it
if need login -> login
again curl_it but with right cookies
return

Everything works if the script is in one file, but as soon as I take the curlt_it function out of the file and connect the file, a separate curl starts overwriting the file, that is, during return the cookies are still correct (received after authorization), but at the time of the end in the original script of the curl_it function from where- then inadequate cookies are taken. I can't figure out why or where.
1-2 files.
1) require_once(2)
1) curlt_it
2) bad cookies
2) if need login -> login
2) good cookies
2) again curl_it but with right cookies
2) good cookies
2) return
1) bad cookies

I take cookies in the function from a file
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);

Also tried to use absolute paths, same thing. All 3 files (1 - 2 script and cookies) are in the same directory.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Fedorov, 2014-02-11
@JekFdrv

My ignorance in php...
Everything after return doesn't work, but I had curl close after it and CURLOPT_COOKIEJAR didn't work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question