PHP cookie for a different domain

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DrSlony
Forum Newbie
Posts: 1
Joined: Mon Mar 19, 2007 12:35 pm

PHP cookie for a different domain

Post by DrSlony »

Hey

I am trying to make my website, lets call it http://www.drslony.org, create a cookie that another website, from a family of websites that I run, will be able to access. Lets call the other one http://www.other.org

Running the code below from http://www.drslony.org will result in a cookie that only drslony.org will be able to access, right?
<?php setcookie("biscuit", "1", "0"); ?>

I assumed that adding http://www.other.org to the domain (as below) will enable http://www.other.org to read the cookie that http://www.drslony.org created, but it doesn't (or at least I don't know how to make it do so).
<?php setcookie("biscuit", "1", "0", "/", "www.other.org"); ?>

Can anyone help me out?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You cannot under any circumstance create a cookie for another domain.
Post Reply