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 ZendHttpHeaderCookie objects. Cookies can be added automatically from a request or manually. Then, the Cookies class 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 ZendHttpHeaderCookie 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 ZendHttpClientCookies::COOKIE_STRING_ARRAY) or one unified string for all cookies (by passing ZendHttpClientCookies::COOKIE_STRING_CONCAT).
Add a cookie to the class. Cookie should be passed either as a ZendHttpHeaderCookie object or as a string - in which case an object is created from the string.
Parameters: |
|
---|---|
Throws ExceptionInvalidArgumentException: | |
Parse an HTTP response, adding all the cookies set in that response
Parameters: |
|
---|
Get all cookies in the cookie jar as an array
Parameters: | int – Whether to return cookies as objects of ZendHttpHeaderSetCookie or as strings |
---|---|
Return type: | array|string |
Return an array of all cookies matching a specific request according to the request URI, whether session cookies should be sent or not, and the time to consider as “now” when checking cookie expiry time.
Parameters: |
|
---|---|
Throws ExceptionInvalidArgumentException: | |
if invalid URI specified |
|
Return type: | array|string |
Get a specific cookie according to a URI and name
Parameters: |
|
---|---|
Throws ExceptionInvalidArgumentException: | |
if invalid URI specified or invalid $retAs value |
|
Return type: | SetCookie|string |
Helper function to recursively flatten an array. Should be used when exporting the cookies array (or parts of it)
Parameters: |
|
---|---|
Return type: | array|string |
Return a subset of the cookies array matching a specific domain
Parameters: | string – |
---|---|
Return type: | array |
Return a subset of a domain-matching cookies that also match a specified path
Parameters: |
|
---|---|
Return type: | array |
Create a new Cookies object and automatically load into it all the cookies set in an Http_Response object. If $uri is set, it will be considered as the requested URI for setting default domain and path of the cookie.
Parameters: |
|
---|---|
Return type: | Cookies |
Todo : |
Empties the cookieJar of any cookie
Return type: | Cookies |
---|
Return cookie(s) as a Zend_Http_Cookie object
Return cookie(s) as a string (suitable for sending in an HTTP request)
Return all cookies as one long string (suitable for sending in an HTTP request)