php curl multiple cookies

Volter picture Volter · Jul 19, 2011 · Viewed 8k times · Source

I want to use "Rapidshare" api for my website, and I have the problem. My problem is that I have multiple rapidshare premium accounts.I have read the information that if i want to use rapidshare api I must create cookies, without it I can't download,upload... files. Is this a correct information and if it is than how can i use rapidshare api with several premium accounts? can i just create these cookies in different folder and than do something, or handle it without creating cookies with php curl?

Answer

jabbany picture jabbany · Jul 19, 2011

I'm not familiar with rapidshare api, but I suppose it means that cookies are set up client side. If you need to let the server perform the action, you may try this.

curl_setopt($ch, CURLOPT_COOKIE, "CookieName=CookieValue;anotherCookieName=anotherCookieValue");

and add some conditional arguments

if($needToUseAccount1){
   curl_setopt($ch, CURLOPT_COOKIE, "cred1=data1;cred1_b=data1_b");
}else{
   //similar with other accounts
}