2

I have actually set the following cookie for the following domain:

setcookie("thing", $data, time()+3600, "/", "example1.com", 1);

The cookie was set from this domain: example2.com

When I try to search for the cookie 'thing' I can't seem to find it. How is it possible to set a cookie on a domain, which will remain on another domain if I search for it?

UPDATE:

I basically want to pass a value from Domain A to Domain B. When a visitor arrives to Domain A he/she gets redirected AND pass a value to Domain B which I'd like to capture there.

How is it possible?

Cœur
  • 34,719
  • 24
  • 185
  • 251
user1406071
  • 607
  • 4
  • 14
  • 24

2 Answers2

3

Every browser prevents it.

Cookies can not be shared between domains. https://wikipedia.org/wiki/Same-Origin-Policy

Zoe stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
scones
  • 3,237
  • 22
  • 32
0

I'm pretty sure it is impossible to create a cookie for another domain - this would be a pretty significant security hole.

See @scones' link.

Hal
  • 1,209
  • 11
  • 26