1

I want to be able to take the cookie information from website a, and then set the cookie on website b.

So when a user visits website b, website b automatically sets the cookies it receives from website a

I have been working on a few attempts to retrieve things using cURL in php.

This is what I have at the moment:

$a = curl_init('http://www.website.com');
  curl_setopt($a, CURLOPT_COOKIEFILE);
  curl_setopt($a, CURLOPT_RETURNTRANSFER, 1);
  $name = curl_Exec($a);
curl_close($a);

$b = curl_init('http://www.website.com');
  curl_setopt($b, CURLOPT_COOKIE);
  curl_setopt($b, CURLOPT_RETURNTRANSFER, 1);
  $value = curl_Exec($b);
curl_close($b);

setcookie('$name','$value');

Obviously, it isn't working.

I'm new to cURL, I'm not sure if what I am trying to do can be done (or should be).

Thank you for your help!

Ryan
  • 433
  • 1
  • 11
  • 29
  • 2
    Possible duplicate: http://stackoverflow.com/questions/315132/how-do-i-use-cookies-across-two-different-domains – Jon Egeland Mar 14 '12 at 00:33
  • Note that Domain_A cannot set cookies on Domain_B. It's basic browser security. You'll need to use a 3rd domain to verify users. – Joseph Lust Mar 21 '12 at 01:11

0 Answers0