basicHeaderGatherer | R Documentation |
These two functions are used to collect the contents of the header of
an HTTP response via the headerfunction
option of a curl handle
and then processing that text into both the name: value pairs
and also the initial line of the response that provides the
status of the request.
basicHeaderGatherer
is a simple special case of
basicTextGatherer
with the built-in post-processing
step done by parseHTTPHeader
.
basicHeaderGatherer(txt = character(), max = NA)
parseHTTPHeader(lines, multi = TRUE)
txt |
any initial text that we want included with the header.
This is passed to |
max |
This is passed directly to
|
lines |
the text as a character vector from the response header
that
|
multi |
a logical value controlling whether we check for
multiple HTTP headers in the lines of text. This is caused
by a Continue being concatenated with the actual response.
When this is |
The return value is the same as basicTextGatherer
,
i.e. a list with
update
, value
and reset
function elements.
The value
element will invoke parseHTTPHeader
on the contents read during the processing of the libcurl request
and return that value.
Duncan Temple Lang
Curl homepage https://curl.se/
basicTextGatherer
curlPerform
curlSetOpt
if(url.exists("https://www.omegahat.net/RCurl/index.html")) withAutoprint({
h = basicHeaderGatherer()
getURI("https://www.omegahat.net/RCurl/index.html",
headerfunction = h$update)
names(h$value())
h$value()
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.