Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any HTTP library in R?

Tags:

r

I need to make HTTP POST commands using R. Are there any R http libraries that can do this?

like image 425
tommy chheng Avatar asked Dec 28 '22 10:12

tommy chheng


2 Answers

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.

like image 78
p00ya Avatar answered Dec 31 '22 03:12

p00ya


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).

like image 33
Ben Mordue Avatar answered Dec 31 '22 03:12

Ben Mordue