Persists non-session cookies using a JSON formatted file

public __construct(string $cookieFile, bool $storeSessionCookies = false)

Create a new FileCookieJar object

  • param string $cookieFile File to store the cookie data
  • param bool $storeSessionCookies Set to true to store session cookies in the cookie jar.
  • throws \RuntimeException if the file cannot be found or created
public __destruct()

Saves the file when shutting down

public load(string $filename) : void

Load cookies from a JSON formatted file.

Old cookies are kept unless overwritten by newly loaded ones.

  • param string $filename Cookie file to load.
  • throws \RuntimeException if the file cannot be loaded.
public save(string $filename) : void

Saves the cookies to a file.

  • param string $filename File to save
  • throws \RuntimeException if the file cannot be found or created
private $filename = NULL
  • var string filename
private $storeSessionCookies = NULL
  • var bool Control whether to persist session cookies or not.
© 2024 Bruce Wells
Search Namespaces \ Classes