【发布时间】:2016-08-28 03:07:57
【问题描述】:
更新:
我正在尝试使用以下方式访问公司内部 Web API:
require(httr)
url = 'https://my_server/api/search/query?q=stuff'
httr::set_config( config(ssl_verifypeer = 0L) )
data <- httr::GET( url, use_proxy(url = "ipaddress:port"), verbose() )
我明白了:
-> CONNECT my_server:port HTTP/1.1
-> Host: my_server:port
-> User-Agent: libcurl/7.47.1 r-curl/0.9.7 httr/1.1.0
-> Proxy-Connection: Keep-Alive
->
<- HTTP/1.1 200 Connection established
<-
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL connect error
我使用了ssl_verifypeer,因为服务器的 CA 证书存在问题。这是导致SSL connect error 问题的原因吗?
如何绕过这个并获取数据?
如果您在 linux 命令行中运行,有没有办法轻弹存在的 --insecure 选项?请注意,我在 Windows 上运行 R。
【问题讨论】:
-
readLines在给定字符串时使用file连接,而不是url连接。明确地做,或者更好,试试httr。此外,您的语法有问题。