first:
yes, this behaviour is securtiy prevernted by browser.
solution:
create setcookie.php in both servers...
so then you can call:
file_get_contents('www.fir
file_get_contents('www.sec
Main Topics
Browse All TopicsHow can I share cookie information across 2 or more different domains? For example, when a user comes to mydomain.com I want to create a cookie for both mydomain.com as well as anotherdomain.com. Is this possible or is this prohibited by browsers?
Basically my second domain points to the first domain so the website is exactly the same but when someone is logged in on the first domain, they are'nt logged in when viewing the site using the second domain. How can I keep cookies for each domain in sync with each other?
My application is written using PHP 5.
I've tried using 2 different setcookie() calls, 1 for each domain but it only creates a cookie for the domain the user is viewing the site in and not the second.
Thanks for any help/ideas.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
first:
yes, this behaviour is securtiy prevernted by browser.
solution:
create setcookie.php in both servers...
so then you can call:
file_get_contents('www.fir
file_get_contents('www.sec
Hi Rok-Kralj
I'm just trying to think how your solution would work...
A user goes to the homepage of firstserver. When dealing with the request PHP will create a new session and then return the reponse, including the cookie information about the new session id.
Are you saying that the after creating the new session, the firstserver should then call file_get_contents('www.sec
which would then create a cookie on the second server? How does the cookie information regarding the secserver get returned to the user?
Here's a description of a hack.
1. when a user logs in, your code has to contact a central login server, and log that user into the "network" of sites. don't return a page yet.
2. the central log in server will return a global session id.
3. your code returns a page, and, on that page, put a bunch of images. in each image, set the SRC to a "remote log in" script on each of the network's servers. in each url, append the session id cookie. also set the user's cookie in this page.
4. each "remote log in" script called will contact the central log in server, to validate the session id. if the cookie validates, then set a set a cookie. also, each script should return it's graphic to the client, so it displays something. maybe it's a 1 pixel gif.
5. the global session id should be expired shortly after this transaction happens, to avoid session hijacks. the individual sessions are managed on each of the sites, not through the central log in server. there are other ways to make this more secure, too.
Business Accounts
Answer for Membership
by: gawaiPosted on 2008-01-13 at 11:24:27ID: 20648756
this may help u r.net/word press/offt opic/cman/ 2007/ 12/13 /php-shari ng-session s-between- multiple-d omains/
http://www.melbournechapte