Simplify Curl::setCookieString

This commit is contained in:
Zach Borboa
2016-07-17 14:41:50 -07:00
parent 93cee4b8e2
commit 6085204f2f
2 changed files with 2 additions and 9 deletions
+1
View File
@@ -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()
+1 -9
View File
@@ -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);
}
/**