RCurl is equivalent to this ...

I am currently using this R code to get what I want to do on an Ubuntu machine ...

jsontext <- '{"text": "its really cold in here"}'
a <- paste('curl -H "Content-Type: application/json" -d ', " '", jsontext, "'", ' -X POST http://urlhere', sep="")
response <- system(a)

This gives me what I get when I type this on the command line ...

curl -H "Content-Type: application/json" -d '{"text": "its really cold in here"}' -X POST http://urlhere

I tried using RCurl postForm (uri = "http: // urlhere", with various parameters ...) and had no results. Is it faster to do this or is it worth it to understand?

thank

+5
source share

All Articles