1

Suppose site URL = WWW.DOMAIN1.COM

for set cookie, code as
  $Name = 'cookiee_name';
  $Value = '123456';
  $Expires = 3600*24;
  $Path = '/';
  $domain1 = 'WWW.DOMAIN1.COM';
  $domain2 = 'WWW.DOMAIN2.COM';
  setcookie($Name,$Value,$Expires,$Path,$domain1);

it sets with $domain1. But when i used $domain2 instead of $domain1 like

setcookie($Name,$Value,$Expires,$Path,$domain2);

it is s not set with $domain2 for $domain1?

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • possible duplicate of [How to set a cookie for another domain](http://stackoverflow.com/questions/6761415/how-to-set-a-cookie-for-another-domain) – Joachim Isaksson Jun 14 '14 at 13:26

1 Answers1

0

You cannot !

You cannot set a cookie from one domain to another. Cookies are only working for domain you are using and purposely designed that way to protect cookie security.

But you can redirect user from domain1 to domain2 and set the domain2 cookie.

Hope this information helps.

M_R_K
  • 5,929
  • 1
  • 39
  • 40