Deleting cookies in other subdomains

I was wondering if it is possible to delete a cookie in PHP, i.e. to re-set the time to time in the past, for a specific subdomain from another subdomain.

For example:

Let's say I execute the following code on one.myserver.com, which is intended to delete a cookie on two.myserver.com

setcookie("ACOOKIE", 0, time() - 3600, "/", "two.myserver.com"); 

This currently does not work for me. Is there a way I can get something like this to work?

+1
php cookies setcookie
source share
3 answers

No, you can only do this from another subdomain.

+4
source share

You do not even know that they exist, because they will be sent (only through the client’s browser) when accessing the domain from which they were originally intended.

+2
source share

Impossible. Cookies can only be installed and removed from the same domain.

+1
source share

All Articles