curlPerform | R Documentation |
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)
curl |
for |
... |
a named list of curl options to set after the handle has been created. |
.opts |
a named list or |
multiple |
a logical value. If |
.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 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 ( |
A integer value indicating the status of the request. This should be 0 as other errors will generate errors.
Duncan Temple Lang
Curl homepage https://curl.se/
getURL
postForm
getForm
curlSetOpt
if(url.exists("https://www.omegahat.net/RCurl")) withAutoprint({
h = basicTextGatherer()
curlPerform(url = "https://www.omegahat.net/RCurl", writefunction = h$update)
# Now read the text that was cumulated during the query response.
cat(h$value())
})
## this no longer exists
if(url.exists("http://services.soaplite.com/hibye.cgi")) withAutoprint({
# SOAP request
body = '<?xml version="1.0" encoding="UTF-8"?>\
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" \
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" \
xmlns:xsd="http://www.w3.org/1999/XMLSchema" \
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" \
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">\
<SOAP-ENV:Body>\
<namesp1:hi xmlns:namesp1="http://www.soaplite.com/Demo"/>\
</SOAP-ENV:Body>\
</SOAP-ENV:Envelope>\n'
h$reset()
curlPerform(url = "http://services.soaplite.com/hibye.cgi",
httpheader=c(Accept="text/xml", Accept="multipart/*",
SOAPAction='"http://www.soaplite.com/Demo#hi"',
'Content-Type' = "text/xml; charset=utf-8"),
postfields=body,
writefunction = h$update,
verbose = TRUE
)
body = h$value()
})
# Using a C routine as the reader of the body of the response.
if(url.exists("https://www.omegahat.net/RCurl/index.html")) withAutoprint({
routine = getNativeSymbolInfo("R_internalWriteTest", PACKAGE = "RCurl")$address
curlPerform(URL = "https://www.omegahat.net/RCurl/index.html",
writefunction = routine)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.