0

I have two domains that I want to communicate. I want the first domain to set a cookie in the second domain telling the second domain that the current user is known to the first domain. I understand that I cannot read cookies for another domain, but given that I have access to both, is there a way to accomplish this?

Both domains are implemented in PHP. One is a Drupal site and the other a WordPress site.

Bob Jones
  • 2,049
  • 5
  • 32
  • 60
  • possible duplicate of [How to set a cookie for another domain](http://stackoverflow.com/questions/6761415/how-to-set-a-cookie-for-another-domain) –  Jan 03 '15 at 20:21

1 Answers1

0

Server can't read cookie for another domain but, you can add cookie for another domain. When adding cookies, you should add double cookie. First your normal cookie and second for another domain. Both values are the same.

Fatih SARI
  • 435
  • 4
  • 21
  • No, this is incorrect. You can only set a cookie for your own domain, or for its parent domain. (For instance, `foo.example.com` can set a cookie for `.example.com`, but not for `bar.example.com` or `example.net`.) –  Jan 03 '15 at 04:39
  • @duskwuff please read this question: http://stackoverflow.com/questions/6761415/how-to-set-a-cookie-for-another-domain actual, your negative vote is incorrect. – Fatih SARI Jan 03 '15 at 14:51
  • The accepted answer to that question says exactly what I just said: you cannot directly set cookies for another domain. (The question is a duplicate, though, so thanks for spotting that.) –  Jan 03 '15 at 20:22
  • Directly or with other methods this is possible. In my answer i may write with incorrect words but this question own research it. – Fatih SARI Jan 03 '15 at 20:59