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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.