add_cookies | R Documentation |
This function allows you to add browser cookies to the cookie storage. It can work with either a cookie file or a direct cookie string (e.g., copied from a CURL call). But remember, just like in real life, you can't have your cookie and eat it too - pick only one!
add_cookies(cookiefile, cookiestring, domain = NULL, confirm = FALSE)
cookiefile |
A character string indicating the path to the cookie file. |
cookiestring |
A character string representing the cookie in string format. |
domain |
An optional parameter that specifies the host/domain. It's only
used when |
confirm |
If |
No explicit return. Instead, this function stores the cookies using
the store_cookies
function.
You can't provide both a cookiefile and a cookiestring at the same time. That's like trying to dunk two cookies in a tiny cup of milk!
Your cookies are saved in an encrypted file. See encrypt_vec for more info.
store_cookies
# 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())
# Using a cookie file:
# 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.
add_cookies(cookiefile = system.file("extdata", "cookies.txt", package = "cookiemonster"))
# Using a cookie string:
add_cookies(cookiestring = "username=johndoe; password=secret", domain = "www.example.com")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.