TecBrat Posted November 18, 2007 Share Posted November 18, 2007 I posted this on another forum and didn't get a reply after a couple of days. I wonder if anyone here can help. I am accessing an application on another server by cURL. That applications sets cookies by javascipt, so they are going on the end-user's system. I can grab them (using the $_COOKIE superglobal) and put them into the curlopt_cookie, and they work as expected as long as I only put in one cookie at a time. When I try <? //... curl_setopt($ch, CURLOPT_COOKIE,$cookie1.';'$cookie2); //... ?> It doesn't work. My understanding is that the third argument should be a string in the format of "name1=value1;name2=value2" I wrote this to try to be sure I got them all, but it still isn't right: <? foreach($_COOKIE as $key=>$value){ $allcookies.=$key."=".$value.";"; } //... curl_setopt($ch, CURLOPT_COOKIE,$allcookies); ?> Any ideas why this does not work? I have tried everything that has come to mind, and nothing. Quote Link to comment https://forums.phpfreaks.com/topic/77789-solved-multiple-cookies-in-curl-curlopt_cookies/ Share on other sites More sharing options...
TecBrat Posted November 23, 2007 Author Share Posted November 23, 2007 The error was that the semicolon delimited list needs a space after the semicolon. <? //... curl_setopt($ch, CURLOPT_COOKIE,$cookie1.'; '.$cookie2); //... ?> Quote Link to comment https://forums.phpfreaks.com/topic/77789-solved-multiple-cookies-in-curl-curlopt_cookies/#findComment-397743 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.