implementing get cookie functionality

This commit is contained in:
Ich
2015-08-18 14:03:56 +02:00
parent 473f080a12
commit 7b4d4da45b
+13
View File
@@ -401,6 +401,9 @@ class Curl
*/
public function headerCallback($ch, $header)
{
if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) == 1) {
$this->cookies[$cookie[1]] = $cookie[2];
}
$this->rawResponseHeaders .= $header;
return strlen($header);
}
@@ -539,6 +542,16 @@ class Curl
$this->setOpt(CURLOPT_COOKIE, str_replace(' ', '%20', urldecode(http_build_query($this->cookies, '', '; '))));
}
/**
* get Cookie
*
* @access public
* @param $key
*/
public function getCookie($key) {
return $this->cookies[$key];
}
/**
* Set Port
*