我目前正在使用这个R代码来获取我想在Ubuntu机器上做的事情......
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)
Run Code Online (Sandbox Code Playgroud)
这给了我在命令提示符下输入时会得到的结果......
curl -H "Content-Type: application/json" -d '{"text": "its really cold in here"}' -X POST http://urlhere
Run Code Online (Sandbox Code Playgroud)
我尝试过使用RCurl postForm(uri ="http:// urlhere",有各种选项......)并且没有任何结果.以这种方式做得更快还是值得搞清楚?
谢谢