Third party cookie example
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));
by Valeri Tandilashvili
3 months ago
HTTP
0
Pro tip: use ```triple backticks around text``` to write in code fences