mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 20:20:53 +00:00
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:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user