Perform the HTTP query

These function causes the HTTP query, that has been specified via the different options in this and other calls, to be sent and processed. Unlike in curl itself, for curlPerform one can specify all the options in this call as an atomic invocation. This avoids having to set the options and then perform the action. Instead, this is all done in one call.

For curlMultiPerform, one must add the relevant CURLHandle-class objects to the MultiCURLHandle-class objects before issuing the call to curlMultiPerform.

curlPerform(..., .opts = list(), curl = getCurlHandle(), .encoding = integer())
curlMultiPerform(curl, multiple = TRUE)

for curlPerform, this is the CURLHandle object giving the structure for the options and that will process the command. For curlMultiPerform, this is an object of class code MultiCURLHandle-class.


a named list of curl options to set after the handle has been created.


a named list or CURLOptions object identifying the curl options for the handle. This is merged with the values of … to create the actual options for the curl handle in the request.


a logical value. If TRUE and the internal call to curl_multi_perform returns a value that indicates there is still data available from one of the HTTP responses, we call curl_multi_perform repeatedly until there is no more data available at that time. If this is FALSE, we call curl_multi_perform once and return, regardless of whether there is more data available. This is convenient if we want to limit the time spent in the call to curlMultiPerform.


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.

Note that the encoding argument is not a regular libcurl option and is handled specially by RCurl. But as a result, it is not unset in subsequent uses of the curl handle (curl).


A integer value indicating the status of the request. This should be 0 as other errors will generate errors.


Curl homepage

See Also

getURL postForm getForm curlSetOpt

  • curlPerform
  • curlMultiPerform
if(url.exists("")) {
  h = basicTextGatherer()
  curlPerform(url = "", writefunction = h$update)
   # Now read the text that was cumulated during the query response.

if(url.exists("")) {
     # SOAP request
  body = '<?xml version="1.0" encoding="UTF-8"?>\
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="" \
                   xmlns:SOAP-ENV="" \
                   xmlns:xsd="" \
                   xmlns:SOAP-ENC="" \
       <namesp1:hi xmlns:namesp1=""/>\

  curlPerform(url = "",
              httpheader=c(Accept="text/xml", Accept="multipart/*",
                           'Content-Type' = "text/xml; charset=utf-8"),
              writefunction = h$update,
              verbose = TRUE

  body = h$value()


   # Using a C routine as the reader of the body of the response.
if(url.exists("")) {
  routine = getNativeSymbolInfo("R_internalWriteTest", PACKAGE = "RCurl")$address
  curlPerform(URL = "",
              writefunction = routine)
# }
Documentation reproduced from package RCurl, version 1.95-4.11, License: BSD

Community examples

Looks like there are no examples yet.