简体   繁体   English

如何使用RCurl将以下简单的curl调用转换为R代码?

[英]How to translate the following simple curl call to R code using RCurl?

Consider the following commands (2 examples) 考虑以下命令(2个示例)

curl -H "Accept:text/plain" http://rxnav.nlm.nih.gov/REST/rxcui/866350/allrelated 

curl -i -L -H "Accept: application/xml"  http://pub.orcid.org/search/orcid-bio?q=digital-object-ids:"10.1088/0031-9155/58/3/535"

The user is able to run those on win7 command line with curl.exe installed. 用户可以在安装了curl.exe的win7命令行上运行它们。 The RCurl package has no vignette and it has a lot of commands to choose from. RCurl包没有小插图,并且有很多命令可供选择。 How do I get the text file and XML file output using RCurl? 如何使用RCurl获取文本文件和XML文件输出?

I think you can use the following : 我认为您可以使用以下方法:

mytxt <- getURL("http://rxnav.nlm.nih.gov/REST/rxcui/866350/allrelated", httpheader=c(Accept="text/plain"))

And : 和:

myxml <- getURL('http://pub.orcid.org/search/orcid-bio?q=digital-object-ids:"10.1088/0031-9155/58/3/535"', httpheader=c(Accept="application/xml"))

You will find many examples in the getURL help page. 您可以在getURL帮助页面中找到许多示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM