Create third party cookie (
setcookie.php
):
$result = setcookie('cooname', 'V37', [
'expires' => time() + 3600,
'path' => '/',
'domain' => '.sibrdzne.ge',
'httpOnly' => true,
'secure' => true,
'SameSite' => 'None'
]);
Receive cookie from another domain (
getcookie.php
):
header('Access-Control-Allow-Origin:'.$_SERVER['HTTP_ORIGIN'] ?? '*');
header('Access-Control-Allow-Credentials:true');
echo $_COOKIE['cooname'] ?? 'no-cookie';
Pass cookie and fetch content from another domain (from console):
fetch('https://sibrdzne.ge/getcookie.php', {
credentials:'include'
}).then(e=>e.text()).then(e=>console.log(e));