diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index b1d1087..95dab62 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -713,6 +713,25 @@ class Curl $this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds); } + /** + * Set Cookie String + * + * @access public + * @param $string + */ + public function setCookieString($string) + { + if(preg_match_all('/\s*([^;=]+)=([^;]+)/i',$string,$matches) > 0){ + if(isset($matches[1]) && isset($matches[2])){ + if(count($matches[1]) === count($matches[2])){ + foreach ($matches[1] as $handle => $key) { + $this->setCookie($key, $matches[2][$handle]); + } + } + } + } + } + /** * Set Cookie File *