if(url.exists("https://www.omegahat.net/RCurl/index.html")) withAutoprint({
txt = getURL("https://www.omegahat.net/RCurl/index.html", write = basicTextGatherer())
h = basicTextGatherer()
txt = getURL("https://www.omegahat.net/RCurl/index.html", write = h$update)
## Cumulate across pages.
txt = getURL("https://www.omegahat.net/index.html", write = h$update)
headers = basicTextGatherer()
txt = getURL("https://www.omegahat.net/RCurl/index.html",
header = TRUE, headerfunction = headers$update)
## Now read the headers.
cat(headers$value())
headers$reset()
## Debugging callback
d = debugGatherer()
x = getURL("https://www.omegahat.net/RCurl/index.html", debugfunction = d$update, verbose = TRUE)
cat(names(d$value()))
d$value()[["headerIn"]]
## This hung on Solaris
## 2022-02-08 philosophy.html is malformed UTF-8
uris = c("https://www.omegahat.net/RCurl/index.html",
"https://www.omegahat.net/RCurl/philosophy.html")
if (FALSE) {
g = multiTextGatherer(uris)
txt = getURIAsynchronous(uris, write = g)
names(txt) # no names this way
nchar(txt)
# Now don't use names for the gatherer elements.
g = multiTextGatherer(length(uris))
txt = getURIAsynchronous(uris, write = g)
names(txt)
nchar(txt)
}
})
if (FALSE) {
Sys.setlocale(,"en_US.latin1")
Sys.setlocale(,"en_US.UTF-8")
uris = c("https://www.omegahat.net/RCurl/index.html",
"https://www.omegahat.net/RCurl/philosophy.html")
g = multiTextGatherer(uris)
txt = getURIAsynchronous(uris, write = g)
}
Run the code above in your browser using DataLab