can i write cookie with from one domain to another 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
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

can i write cookie with from one domain to another domain

Post by renu »

how can i write cookie with from one domain to another domain.

i want to set cookie with its domain name(this file is on server) on client's machine.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I dont get what you mean. setcookie() sets a cookie. You can specifiy the domain name in that, if that's what you are referring to. Cookies are set for the browser itself... upon viewing the page that sets the cookie.

http://www.php.net/setcookie/
(this file is on server)
Huh??
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

But isnt the cookie file contents for that particular site sent to the server ? Otherwise how could we possibly access on the server using $_COOKIES ?
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post by renu »

Actually i have a file which generates some javascript code which will be saved at client's machine and will run from client's machine. and tht javascript code also set cookie on client's machine.so i want tht cookie to be set with my site's domain name.

Am i clear now.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

a cookie will only set to your domain.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Well if I'm not misunderstanding you ...

Use an <img src="http://yourserver.com/cooksetter.php?client=1234" width=0 height=0> you can even pass variables. User could always reject the cookie and rejection might even be automatic. Don't forget to return an image.
Post Reply