public function FileCookieJar::save in Auth0 Single Sign On 8.2
Saves the cookies to a file.
Parameters
string $filename File to save:
Throws
\RuntimeException if the file cannot be found or created
1 call to FileCookieJar::save()
- FileCookieJar::__destruct in vendor/
guzzlehttp/ guzzle/ src/ Cookie/ FileCookieJar.php - Saves the file when shutting down
File
- vendor/
guzzlehttp/ guzzle/ src/ Cookie/ FileCookieJar.php, line 49
Class
- FileCookieJar
- Persists non-session cookies using a JSON formatted file
Namespace
GuzzleHttp\CookieCode
public function save($filename) {
$json = [];
foreach ($this as $cookie) {
/** @var SetCookie $cookie */
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
$json[] = $cookie
->toArray();
}
}
$jsonStr = \GuzzleHttp\json_encode($json);
if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}