Multiple cURL actions, same session

Cleplecix

New Member
First of all I'm aware of curl_multi_init but it doesn't exactly do what I need, to my knowledge.Im downloading files behind a login, so a) Need to loginb) Download image(s)Here is what I currently have\[code\]$login_url = 'https://us.test.com/Member/Login';$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$login_url);curl_setopt($ch, CURLOPT_POSTFIELDS, 'login='.$this->username.'&password='.$this->userpass.'&signin=1&login_referer=none&remember_me=1');curl_setopt($ch, CURLOPT_FAILONERROR,1); curl_setopt($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/test/cookie.txt');curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/test/cookie.txt'); curl_setopt($ch, CURLOPT_COOKIESESSION, true);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_POST, true); curl_exec($ch);//Grab and Write the image$image = file_get_contents($image_url); $f = fopen($_SERVER['DOCUMENT_ROOT'].'/test/uploads/'.$id.'.jpg', 'w');fwrite($f, $image);fclose($f); curl_close($ch);\[/code\]Anything helps, much appreciated.
 
Back
Top