Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

rcurl

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
like image 855
mikecro Avatar asked May 08 '17 08:05

mikecro


1 Answers

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))
like image 95
user1966593 Avatar answered Oct 21 '22 03:10

user1966593