diff --git a/README.md b/README.md index dd89e3c..85b8399 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ Curl::setConnectTimeout($seconds) Curl::setCookie($key, $value) Curl::setCookieFile($cookie_file) Curl::setCookieJar($cookie_jar) +Curl::setCookieString($string) Curl::setDefaultJsonDecoder() Curl::setDefaultTimeout() Curl::setDefaultUserAgent() diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 95dab62..aae4472 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -721,15 +721,7 @@ class Curl */ 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]); - } - } - } - } + return $this->setOpt(CURLOPT_COOKIE, $string); } /**