Curlopt_cookie problems
I use Curlopt_cookie to discover that the previous cookie overwrites the latter cookie. And there is a problem in writing, the result of printing is not want, incorrect
$PostData = Array (
' ZipCode ' = ' 12345 ',
' LangId ' = '-1 ',
' StoreId ' = ' 10001 ',
' URL ' = '/brother-tn-580-toner-cartridge-high-yield/product_612784 ',
' Errorurl ' = ' zipcode '
);
$ua = ' mozilla/5.0 (Windows; U Windows NT 5.1; Ru rv:1.9.1.3) gecko/20090824 firefox/3.5.3 (. NET CLR 3.5.30729) ';
$url = ' http://www.staples.com/Brother-TN-580-Toner-Cartridge-High-Yield/product_612784 ';
$host = $_server[' document_root ');
if ($curl = Curl_init ())
{
curl_setopt ($curl, Curlopt_url, ' http://www.chenzhi.com/2.php ');
curl_setopt ($curl, Curlopt_cookie, ' coreid6=30201255514912193294815; path=/;D Omain=www.chenzhi.com;expires=mon, 13-oct-24 13:08:16 GMT ');
curl_setopt ($curl, Curlopt_cookie, ' testsess3=x; path=/;D omain=www.chenzhi.com;expires=end of Session ');
curl_setopt ($curl, Curlopt_cookie, ' 90028341_login=1255528626018461671490028341; path=/;D omain=www.chenzhi.com;expires=end of Session ');
curl_setopt ($curl, Curlopt_cookie, ' 90028341_reset=1255528626; path=/;D omain=www.chenzhi.com;expires=end of Session ');
curl_setopt ($curl, curlopt_followlocation, true);
curl_setopt ($curl, Curlopt_returntransfer, false);
Curl_exec ($curl);
Curl_close ($curl);
} else {
Die (' 1 fails: '. Curl_error ($curl));
}
Unset ($curl);
Results of printing
Array
(
[90028341_reset] = 1255528626
[Path] =/
[Domain] = www.chenzhi.com
[Expires] = End of Session
)
And the normal Setcookie show the result is actually
Setcookie ("TestCookie1", ' 1 ', Time () +3600, "/", ' www.chenzhi.com ');
Setcookie ("TestCookie2", ' 2 ', Time () +3600, "/", ' www.chenzhi.com ');
Setcookie ("TestCookie3", ' 3 ', Time () +3600, "/", ' www.chenzhi.com ');
Setcookie ("TestCookie4", ' 4 ', Time () +3600, "/", ' www.chenzhi.com ');
Echo '';
Print_r ($_cookie);
Echo '
';
Array
(
[TestCookie1] = 1
[TestCookie2] = 2
[TestCookie3] = 3
[TestCookie4] = 4
)
How do the great gods write the value of multiple cookies with Curlopt_cookie? Solving Cookies Curl