Jump to content

[SOLVED] Multiple cookies in cURL CURLOPT_COOKIES


TecBrat

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.