curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
site.com FALSE / FALSE 1475762564 csrftoken efe1ce7900138db355aec682c44d21a5
public static function parsingCookieFile($cookieFile)
{
$handle = fopen($cookieFile, 'r');
for ($i = 0; $i < 4; $i++) {
if (!feof($handle)) {
fgets($handle);
}
}
$out = [];
while (!feof($handle)) {
$buffer = fgets($handle);
preg_match('/\tFALSE\t\/\tFALSE\t[0-9]+\t([^\t]*)\t(.*)/', $buffer, $found);
if (isset($found[1]) && isset($found[2])) {
$out[$found[1]] = $found[2];
}
}
fclose($handle);
return $out;
}