tryCatch(withAutoprint({
h = basicTextGatherer()
curlPerform(url = "https://r-project.org", writefunction = h$update)
# Now read the text that was cumulated during the query response.
cat(h$value())
}), GenericCurlError = identity)
if (FALSE) {
## this no longer exists
if(url.exists("http://services.soaplite.com/hibye.cgi")) withAutoprint({
# SOAP request
body = '\
\
\
\
\
\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.
tryCatch(withAutoprint({
routine = getNativeSymbolInfo("R_internalWriteTest", PACKAGE = "RCurl")$address
curlPerform(URL = "https://r-project.org",
writefunction = routine)
}), GenericCurlError = identity)
Run the code above in your browser using DataLab