I know it's not possible to set a cookie that can be accessed by multiple domains. However, is it possible to set a cookie on one domain that is only accessible by another.

For example, could I set a cookie on mydomain.com that looks like this:

$cookie_path = '/home/pathtonewdomain';
$cookie_domain = ".newdomain.com";
define("COOKIE_PATH", $cookie_path);
define("COOKIE_DOMAIN", $cookie_domain);

setcookie("yourgfmrefdomain", $refdomain, $exp, COOKIE_PATH2, COOKIE_DOMAIN2);

That I can pull up on the newdomain.com?

    noimad1;10923613 wrote:

    I know it's not possible to set a cookie that can be accessed by multiple domains. However, is it possible to set a cookie on one domain that is only accessible by another.

    For example, could I set a cookie on mydomain.com that looks like this:

    $cookie_path = '/home/pathtonewdomain';
    $cookie_domain = ".newdomain.com";
    define("COOKIE_PATH", $cookie_path);
    define("COOKIE_DOMAIN", $cookie_domain);

    setcookie("yourgfmrefdomain", $refdomain, $exp, COOKIE_PATH2, COOKIE_DOMAIN2);

    That I can pull up on the newdomain.com?

    Not 100% but I'm sure if you dont put a domain it will be accessible by the cookie name. In your code you're setting the cookie name to "yourgfmrefdomain".

      Write a Reply...