简体   繁体   English

R - 更改站点后使用 curl 中的 getURL 时出错

[英]R - Error when using getURL from curl after site was changed

I have been using getURL from curl (in R) to read from https://fantasy.premierleague.com/drf/bootstrap-static我一直在使用 curl(在 R 中)的 getURL 从https://fantasy.premierleague.com/drf/bootstrap-static读取

Example code: print(getURL("https://fantasy.premierleague.com/drf/bootstrap-static"))示例代码: print(getURL("https://fantasy.premierleague.com/drf/bootstrap-static"))

No problem until a few days ago.直到几天前都没有问题。 But now getting the error:但现在得到错误:

 Error in function (type, msg, asError = TRUE) : error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Have upgraded to latest R (3.4.0) and curl package: RCurl_1.95-4.8已升级到最新的 R (3.4.0) 和 curl 包:RCurl_1.95-4.8

I have a workaround (to use GET from httr) but can anyone help me get it working with getURL?我有一个解决方法(从 httr 使用 GET),但谁能帮我让它与 getURL 一起工作?

I believe the server change is that they only now support TLS 1.2.我相信服务器的变化是他们现在只支持 TLS 1.2。 I have tried the following to fix but now get a new error.我尝试了以下修复,但现在出现新错误。 May relate to needing newer OpenSSL?可能与需要更新的 OpenSSL 相关?

CURL_SSLVERSION_TLSv1_2 <- 6L
opt <- RCurl::curlOptions(verbose = TRUE, sslversion = 
CURL_SSLVERSION_TLSv1_2)
print( RCurl::getURL("https://fantasy.premierleague.com/drf/bootstrap-static", .opts = opt))

New error is:新错误是:

 Unsupported SSL protocol version

I think if you remove the getURL part of the code it should work ok我认为如果您删除代码的getURL部分,它应该可以正常工作

url = "https://fantasy.premierleague.com/drf/bootstrap-static"
json = fromJSON((url))

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

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