Here is the scenario: when the user is clicking on a link on my webpage i want to perform a login to another site, and use the cookies to login the user to the second site.
I’m using PEAR Request2 and i’m able to get the login cookies but when i use:
setcookie($cookies['1']['name'], $cookies['1']['value'], time()+3600, '/');
header("Location: http://www.example.com");
the cookie host is my site and i suspect that is why i get a login error.
Is there anyway to issue a cookie as the secondary site – or do you have any suggestion how can i simulate login (i have all the relevant information) and redirect the user to home page?
Figured it out! you can only set the cookie on the client side for your domain.
I was fetching the cookies from a 3rd party website and tried to set those cookies, this can only b done using javascript 🙂