Reputation: 33
I have 2 websites and I would like to use the same cookie for both websites. The problem is they are not in the same domain.
How can I do ?
Upvotes: 0
Views: 62
Reputation: 21449
You can set two cookies for both domains, example PHP code:
setcookie("TestCookie", "value", $path, "domain1.com");
setcookie("TestCookie", "value", $path, "domain2.com");
Link:
http://php.net/manual/en/function.setcookie.php
Upvotes: 1
Reputation: 5852
You can't do that with cookies.
You have to save the data of your cookies on your server. You can use a database to do this.
Upvotes: 0
Reputation: 13990
I guess you can't. Cookies are only sent to the domain they belong to. You most create diferent cookies to both diferent domains.
Upvotes: 0