Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getCurlHandle

Create libcurl handles


Description

These functions create and duplicate curl handles for use in calls to the HTTP facilities provided by that low-level language and this R-level interface. A curl handle is an opaque data type that contains a reference to the internal C-level data structure of libcurl for performing HTTP requests.

The getCurlMutliHandle returns an object that can be used for concurrent, multiple requests. It is quite different from the regular curl handle and again, should be treated as an opaque data type.

Usage

getCurlHandle(..., .opts = NULL, .encoding = integer(),
              .defaults = getOption("RCurlOptions"))
dupCurlHandle(curl, ..., .opts = NULL, .encoding = integer())
getCurlMultiHandle(..., .handles = list(...))

Arguments

curl

the existing curl handle that is to be duplicated

...

a named list of curl options to set after the handle has been created. For getCurlMultiHandle, these values are invidivual curl handle objects, created via getCurlHandle or dupCurlHandle.

.opts

a named list or CURLOptions object identifying the curl options for the handle. These and the ... arguments are used after the handle has been created.

.encoding

an integer or a string that explicitly identifies the encoding of the content that is returned by the HTTP server in its response to our query. The possible strings are ‘UTF-8’ or ‘ISO-8859-1’ and the integers should be specified symbolically as CE_UTF8 and CE_LATIN1. Note that, by default, the package attempts to process the header of the HTTP response to determine the encoding. This argument is used when such information is erroneous and the caller knows the correct encoding.

.defaults

a collection of default values taken from R's global/session options. This is a parameter so that one can override it if necessary.

.handles

a list of curl handle objects that are used as the individual request handles within the multi-asynchronous requests

Details

These functions create C-level data structures.

Value

An object of class CURLHandle which is simply a pointer to the memory for the C structure.

Author(s)

Duncan Temple Lang

References

Curl homepage http://curl.haxx.se

See Also

Examples

options(RCurlOptions = list(verbose = TRUE,
                              followlocation = TRUE,
                              autoreferer = TRUE,
                              nosignal = TRUE))
  if(url.exists("http://www.omegahat.net/RCurl")) {
     x = getURL("http://www.omegahat.net/RCurl")
        # here we override one of these.
     x = getURL("http://www.omegahat.net/RCurl", verbose = FALSE)
  }

RCurl

General Network (HTTP/FTP/...) Client Interface for R

v1.98-1.3
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.