我收到了以下帖子说明,我正在尝试将其翻译为httr:
<form method="POST" action="https://this.website.com/foldername>
<input type="hidden" name="ExternalAction" value="AgetAscii">
File Type <input type="text" name="filechar" value="0">
<input type="submit" value="Click here to Retrieve the File"/>
</form>
我在获取httr的正确语法时遇到了问题。我欢迎大家的建议。最初的输入类型、名称和值看起来很简单,但我不知道如何将文件类型参数带入httr,我也不确定是否正确处理了最后的“提交”和值项。
我欢迎大家的建议。
非常感谢
发布于 2019-07-22 23:17:47
如果我将示例html粘贴到本地html文件中,并将操作替换为http://bin.org/post
,如下所示:
<form method="POST" action="http://httpbin.org/post">
<input type="hidden" name="ExternalAction" value="AgetAscii">
File Type <input type="text" name="filechar" value="0">
<input type="submit" value="Click here to Retrieve the File"/>
</form>
那么httpbin.org报告的唯一已经收到的表单数据就是ExternalAction
和filechar
。因此,要通过httr::POST()
发送此数据,您需要执行以下操作:
library(httr)
action <- "https://this.website.com/foldername"
body <- list(ExternalAction = "AgetAscii",
filechar = "0")
POST(url = action, body = body)
https://stackoverflow.com/questions/57151240
复制相似问题