56        $this->_cookies =& $storageArray;
 
   72        $urlParts = parse_url($request_url);
 
   73        $defaultDomain = $urlParts[
'host'];
 
   78        foreach ($cookies as $cookie) {
 
  104        if (!count($this->_cookies)) {
 
  109        $target = parse_url($request_url);
 
  116        $matching_cookies = array();
 
  117        foreach ($this->_cookies as 
$key => $cookie) {
 
  119                $matching_cookies[$cookie[
'name']] = $cookie[
'value'];
 
  122        return $matching_cookies;
 
  141            if ( preg_match(
'/^Set-Cookie2?: /i', $line)) {
 
  163        if (!$defaultDomain) {
 
  165                '$defaultDomain was not provided.' 
  171            'domain' => $defaultDomain,
 
  176        $line = preg_replace(
'/^Set-Cookie2?: /i', 
'', trim($line));
 
  179        $line = trim($line, 
';');
 
  188        $attributeStrings = explode(
';', $line);
 
  190        foreach ( $attributeStrings as $attributeString ) {
 
  192            $attributeParts = explode(
'=', $attributeString, 2);
 
  194            $attributeName = trim($attributeParts[0]);
 
  195            $attributeNameLC = strtolower($attributeName);
 
  197            if (isset($attributeParts[1])) {
 
  198                $attributeValue = trim($attributeParts[1]);
 
  200                if (strpos($attributeValue, 
'"') === 0) {
 
  201                    $attributeValue = trim($attributeValue, 
'"');
 
  203                    $attributeValue = str_replace(
'\"', 
'"', $attributeValue);
 
  206                $attributeValue = 
null;
 
  209            switch ($attributeNameLC) {
 
  211                $cookie[
'expires'] = strtotime($attributeValue);
 
  214                $cookie[
'max-age'] = (int)$attributeValue;
 
  216                if ($cookie[
'max-age']) {
 
  217                    $cookie[
'expires'] = time() + $cookie[
'max-age'];
 
  221                    $cookie[
'expires'] = time() - 1;
 
  225                $cookie[
'secure'] = 
true;
 
  235                $cookie[$attributeNameLC] = $attributeValue;
 
  238                $cookie[
'name'] = $attributeName;
 
  239                $cookie[
'value'] = $attributeValue;
 
  259        $this->_cookies[] = $cookie;
 
  274        if (!isset($cookie[
'domain'])
 
  275            || !isset($cookie[
'path'])
 
  276            || !isset($cookie[
'path'])
 
  281        foreach ($this->_cookies as 
$key => $old_cookie) {
 
  282            if ( $cookie[
'domain'] == $old_cookie[
'domain']
 
  283                && $cookie[
'path'] == $old_cookie[
'path']
 
  284                && $cookie[
'name'] == $old_cookie[
'name']
 
  286                unset($this->_cookies[
$key]);
 
  300        foreach ($this->_cookies as 
$key => $cookie) {
 
  301            if (isset($cookie[
'expires']) && $cookie[
'expires'] < time()) {
 
  302                unset($this->_cookies[
$key]);
 
  321                '$target must be an array of URL attributes as generated by parse_url().' 
  326                '$target must be an array of URL attributes as generated by parse_url().' 
  331        if ($cookie[
'secure'] && 
$target[
'scheme'] != 
'https') {
 
  337        if (strpos($cookie[
'domain'], 
'.') === 0) {
 
  339            if (substr($cookie[
'domain'], 1) == 
$target[
'host']) {
 
  344                $pos = strripos(
$target[
'host'], $cookie[
'domain']);
 
  349                if ($pos + strlen($cookie[
'domain']) != strlen(
$target[
'host'])) {
 
  355                $hostname = substr(
$target[
'host'], 0, $pos);
 
  356                if (strpos($hostname, 
'.') !== 
false) {
 
  363            if (strcasecmp(
$target[
'host'], $cookie[
'domain']) !== 0) {
 
  369        if (isset($cookie[
'ports'])
 
  370            && !in_array(
$target[
'port'], $cookie[
'ports'])
 
  376        if (strpos(
$target[
'path'], $cookie[
'path']) !== 0) {
 
This class provides access to service cookies and handles parsing of response headers to pull out coo...
parseCookieHeader($line, $defaultDomain)
Parse a single cookie header line.
storeCookies($request_url, $response_headers)
Store cookies for a web service request.
cookieMatchesTarget($cookie, $target)
Answer true if cookie is applicable to a target.
parseCookieHeaders( $header, $defaultDomain)
Parse Cookies without PECL From the comments in http://php.net/manual/en/function....
expireCookies()
Go through our stored cookies and remove any that are expired.
discardCookie($cookie)
Discard an existing cookie.
__construct(array &$storageArray)
Create a new cookie jar by passing it a reference to an array in which it should store cookies.
storeCookie($cookie)
Add, update, or remove a cookie.
getCookies($request_url)
Retrieve cookies applicable for a web service request.
An exception for terminatinating execution or to throw for unit testing.
Exception that denotes invalid arguments were passed.
static trace($str)
This method is used to log something in debug mode.
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode.