mbabker/BabDev-Libraries — pull request #1 by anibalsanchez (2012-05-05 13:26:12+00:00)
Title: Improvements based on "Plugin Include Component Plugin"

Hi Mike,

I've just added features from Mike Reumer "Plugin Include Component Plugin".

// Enable Post
curl_setopt($ch, CURLOPT_POST, true);

...

$cookie = '';
$reg = '/^[a-f0-9]+$/si';
//get all session parameters
foreach ($_COOKIE as $key => $value)
if (preg_match($reg, $key)>0) $cookie.="$key=$value; "; // separation in cookies is ; with space!

// Include all cookies
if ( strlen($cookie)>0 ){
// False to keep all cookies of previous session
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}

....

// stop after 10 redirects
curl_setopt ($ch, CURLOPT_MAXREDIRS, 10);

Thanks,
Anibal