Say I have a website called a.com
, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called b.com
You cannot set cookies for another domain. Allowing this would present an enormous security flaw.
You need to get b.com to set the cookie. If a.com redirect the user to b.com/setcookie.php?c=value
The setcookie script could contain the following to set the cookie and redirect to the correct page on b.com