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

戏子无情 提交于 2019-12-06 13:33:51

问题


I have been using getURL from curl (in R) to read from https://fantasy.premierleague.com/drf/bootstrap-static

Example code: 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

I have a workaround (to use GET from httr) but can anyone help me get it working with getURL?

I believe the server change is that they only now support TLS 1.2. I have tried the following to fix but now get a new error. May relate to needing newer 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


回答1:


I think if you remove the getURL part of the code it should work ok

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


来源:https://stackoverflow.com/questions/43843204/r-error-when-using-geturl-from-curl-after-site-was-changed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!