download.file 仅适用于 https
download.file works only over https
我有一个奇怪的问题。我使用 quantmod
包从 "oanda" 供应商处获取费率。它在内部使用 download.file
函数,该函数失败并显示一条消息
cannot open URL 'http://www.oanda.com/.....'
我能够将问题缩小到:
> download.file("https://oanda.com", destfile="/tmp/gh")
trying URL 'https://oanda.com'
downloaded 95 KB
> download.file("http://oanda.com", destfile="/tmp/gh")
trying URL 'http://oanda.com'
Error in download.file("http://oanda.com", destfile = "/tmp/gh") :
cannot open URL 'http://oanda.com'
注意上面http
/https
的区别。
这对于任何其他域都是可重现的。我完全迷失了,因为我无法 google 任何痕迹发生在其他任何人身上。 wget
从命令行完美适用于这两个地址。
可能不相关的环境详细信息: 我已安装 RCurl
。它来自安装在 AWS 上的本地 shiny
服务器下的 运行。 Ubuntu14LTS。
那么,我怎样才能让 quantmod
使用 https
进行调用,或者我怎样才能让 download.file
与 http
一起工作?
我在上面发表我的评论作为回答。
请参阅此错误报告:http://github.com/joshuaulrich/quantmod/issues/83
卷曲似乎有问题。
如果 wget 工作正常,您可以按照相同的建议尝试使用 R 命令 options(download.file.method="wget")
使用 wget 而不是 curl 下载 quantmod。
我有一个奇怪的问题。我使用 quantmod
包从 "oanda" 供应商处获取费率。它在内部使用 download.file
函数,该函数失败并显示一条消息
cannot open URL 'http://www.oanda.com/.....'
我能够将问题缩小到:
> download.file("https://oanda.com", destfile="/tmp/gh")
trying URL 'https://oanda.com'
downloaded 95 KB
> download.file("http://oanda.com", destfile="/tmp/gh")
trying URL 'http://oanda.com'
Error in download.file("http://oanda.com", destfile = "/tmp/gh") :
cannot open URL 'http://oanda.com'
注意上面http
/https
的区别。
这对于任何其他域都是可重现的。我完全迷失了,因为我无法 google 任何痕迹发生在其他任何人身上。 wget
从命令行完美适用于这两个地址。
可能不相关的环境详细信息: 我已安装 RCurl
。它来自安装在 AWS 上的本地 shiny
服务器下的 运行。 Ubuntu14LTS。
那么,我怎样才能让 quantmod
使用 https
进行调用,或者我怎样才能让 download.file
与 http
一起工作?
我在上面发表我的评论作为回答。
请参阅此错误报告:http://github.com/joshuaulrich/quantmod/issues/83
卷曲似乎有问题。
如果 wget 工作正常,您可以按照相同的建议尝试使用 R 命令 options(download.file.method="wget")
使用 wget 而不是 curl 下载 quantmod。