Is there any HTTP library in R?
I need to make HTTP POST commands using R. Are there any R http 开发者_StackOverflowlibraries that can do this?
Yes, RCurl
library(RCurl)
# example from the vignette:
x = postForm('http://www.wormbase.org/db/searches/advanced/dumper',
species="briggsae",
list="",
flank3="0",
flank5="0",
feature="Gene Models",
dump = "Plain TEXT",
orientation = "Relative to feature",
relative = "Chromsome",
DNA ="flanking sequences only",
.cgifields =c("feature", "orientation", "DNA", "dump", "relative"))
If you want fine-grained control over the posted entity and headers, you can use curlPerform
directly.
Another alternative that may be more convenient to use is httr:
Useful tools for working with HTTP organised by HTTP verbs (GET(), POST(), etc). Configuration functions make it easy to control additional request components (authenticate(), add_headers() and so on).
精彩评论