PHP WebSocket2 Library
PHP5 Library for browsing web
HttpCookieManager Class Reference

HTTP cookie manager. More...

Public Member Functions

 addCookie (HttpCookie $cookie)
 Adds new cookie. More...
 
 filterCookies (callable $filter_func)
 Performs cookie enumeration and filtering. More...
 
 cleanupCookies ($current_time)
 Performs cookie cleanup. Removes all expired cookies. More...
 
 getAllCookies ()
 Returns all cookies. More...
 
 removeAllCookies ()
 Removes all cookies.
 
 getCookies (WebRequest $request)
 Adds all cookies that match specified request to that request. More...
 

Data Fields

const FILTER_NEXT = 0
 Cookie filtering mode: go to next cookie.
 
const FILTER_ABORT = 1
 Cookie filtering mode: abort cookie enumeration.
 
const FILTER_REMOVE_COOKIE_NEXT = 2
 Cookie filtering mode: remove current cookie and go to next one.
 
const FILTER_REMOVE_COOKIE_ABORT = 3
 Cookie filtering mode: remove current cookie and abort cookie enumeration.
 

Detailed Description

HTTP cookie manager.

Examples:
basic_http_authentication.php, and http_cookies.php.

Member Function Documentation

addCookie ( HttpCookie  $cookie)

Adds new cookie.

Parameters
HttpCookie$cookieCookie to add
cleanupCookies (   $current_time)

Performs cookie cleanup. Removes all expired cookies.

Parameters
mixed$current_timeCan be null, which means session end. Can be int (current UNIX timestamp)
filterCookies ( callable  $filter_func)

Performs cookie enumeration and filtering.

Filtering function must have the following prototype:

int func(HttpCookie $cookie);

Where cookie is current HttpCookie object.
Return value must be one of FILTER_NEXT, FILTER_ABORT, FILTER_REMOVE_COOKIE_NEXT and FILTER_REMOVE_COOKIE_ABORT.

Parameters
callable$filter_funcCookie filtering function
getAllCookies ( )

Returns all cookies.

Return values
ArrayCookies array (value is HttpCookie, key is index)
getCookies ( WebRequest  $request)

Adds all cookies that match specified request to that request.

Exactly, adds Set-Cookie headers to request.

Parameters
WebRequest$requestHTTP request

The documentation for this class was generated from the following file: