store_cookies | R Documentation |
Store cookies in a jar
store_cookies(cookies, jar = default_jar(), confirm = FALSE)
cookies |
A data frame of cookies |
jar |
The directory to store the cookies in. Defaults to
|
confirm |
If |
No return value, called to save (encrypted) cookies on disk.
# to conform with CRAN policies, examples use a temporary location. Do not use
# the options like this, except you want your cookies gone when closing R.
options(cookie_dir = tempdir())
if (requireNamespace("curl", quietly = TRUE)) {
# get cookies from a curl request
library(curl)
h <- new_handle()
resp <- curl_fetch_memory("https://hb.cran.dev/cookies/set?new_cookies=moo", handle = h)
cookies <- handle_cookies(h)
# then store them for future use
store_cookies(cookies)
# then you can retrieve them and use in future calls
get_cookies("hb.cran.dev")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.