pathFileNameCookie = tempnam(sys_get_temp_dir(), SESSION_COOKIE_PREFEIX))) { throw new CodeException('Error creating output file.', ERROR_IO_CREATE_FILE); } foreach ($_COOKIE as $name => $value) { // e.g.: SANDBOXSESSION=a83f1o69jbv12932q54hmgphk6; domain=qfq.math.uzh.ch; path=/; $lines .= $name . "=" . $value . "; domain=$domain; path=$path;\n"; } file_put_contents($this->pathFileNameCookie, $lines, FILE_APPEND); } /** * Unlink current cookie file */ public function __destruct() { if (file_exists($this->pathFileNameCookie)) { unlink($this->pathFileNameCookie); $this->pathFileNameCookie = ''; } } /** * @return string PathFilename of cookie file */ public function getFile() { return $this->pathFileNameCookie; } }