A Zend_Http_CookieJar object is designed to contain and maintain HTTP cookies, and should be used along with Zend_Http_Client in order to manage cookies across HTTP requests and responses.
The class contains an array of Zend_Http_Cookie objects. Cookies can be added to the jar automatically from a request or manually. Then, the jar can find and return the cookies needed for a specific HTTP request.
A special parameter can be passed to all methods of this class that return cookies: Cookies can be returned either in their native form (as Zend_Http_Cookie objects) or as strings - the later is suitable for sending as the value of the "Cookie" header in an HTTP request. You can also choose, when returning more than one cookie, whether to get an array of strings (by passing Zend_Http_CookieJar::COOKIE_STRING_ARRAY) or one unified string for all cookies (by passing Zend_Http_CookieJar::COOKIE_STRING_CONCAT).
link | for some specs. |
---|---|
category | Zend |
package | Zend_Http |
subpackage | CookieJar |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
__construct()
addCookie(\Zend_Http_Cookie|string $cookie, \Zend_Uri_Http|string $ref_uri= null
, boolean $encodeValue= true
)
\Zend_Http_Cookie
string
\Zend_Uri_Http
string
Optional reference URI (for domain, path, secure)
boolean
addCookiesFromResponse(\Zend_Http_Response $response, \Zend_Uri_Http|string $ref_uri, boolean $encodeValue = true
)
\Zend_Http_Response
\Zend_Uri_Http
string
Requested URI
boolean
count() : integer
integer
fromResponse(\Zend_Http_Response $response, $ref_uri) : \Zend_Http_CookieJar
todo | Add the $uri functionality. |
---|
\Zend_Http_Response
HTTP Response object
\Zend_Http_CookieJar
getAllCookies(integer $ret_as = self::COOKIE_OBJECT
) : array | string
integer
Whether to return cookies as objects of Zend_Http_Cookie or as strings
array
string
getCookie(\Zend_Uri_Http|string $uri, string $cookie_name, integer $ret_as = self::COOKIE_OBJECT
) : \Zend_Http_Cookie | string
\Zend_Uri_Http
string
The uri (domain and path) to match
string
The cookie's name
integer
Whether to return cookies as objects of Zend_Http_Cookie or as strings
\Zend_Http_Cookie
string
getIterator() : \ArrayIterator
\ArrayIterator
getMatchingCookies(string|\Zend_Uri_Http $uri, boolean $matchSessionCookies= true
, integer $ret_as= self::COOKIE_OBJECT
, integer $now= null
) : array | string
string
\Zend_Uri_Http
URI to check against (secure, domain, path)
boolean
Whether to send session cookies
integer
Whether to return cookies as objects of Zend_Http_Cookie or as strings
integer
Override the current time when checking for expiry time
array
string
isEmpty() : boolean
boolean
reset() : \Zend_Http_CookieJar
\Zend_Http_CookieJar
_flattenCookiesArray(\Zend_Http_Cookie|array $ptr, integer $ret_as = self::COOKIE_OBJECT
) : array | string
\Zend_Http_Cookie
array
integer
What value to return
array
string
_matchDomain(string $domain) : array
string
array
_matchPath($domains, string $path) : array
string
array
$_rawCookies : array
array()
COOKIE_OBJECT = 0
COOKIE_STRING_ARRAY = 1
COOKIE_STRING_CONCAT = 2
COOKIE_STRING_CONCAT_STRICT = 3