Merge branch 'master' of git://github.com/mydansun/php-curl-class into mydansun-master

* 'master' of git://github.com/mydansun/php-curl-class:
  Update Curl.php
  Update Curl.php
  Add setCookieString method on Curl.php
This commit is contained in:
Zach Borboa
2016-07-17 13:55:58 -07:00
+19
View File
@@ -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
*