I set cookies on main.com, but i need to get these cookies from other my domain2.com, how to do this with curl or another ways?
It`s my code in domain2.com/get.php:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://main.com');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
preg_match_all('#Set-Cookie: (.*);#U', $data, $matches);
$cookies = implode(';', $matches[1]);
echo $cookies;
Is it possible?