using Rcurl with HTTPs

前端 未结 2 1906
执笔经年
执笔经年 2020-12-08 17:27

I tried the following code in R on windows:

library(RCurl)
postForm(\"https://www.google.com/accounts/ClientLogin/\",
    \"email\" = \"me@gmail.com\",
    \         


        
相关标签:
2条回答
  • 2020-12-08 18:18

    just add .opts = list(ssl.verifypeer = FALSE) to your query

    postForm("https://www.google.com/accounts/ClientLogin/",
        "email" = "me@gmail.com",
        "Passwd" = "abcd",
        "service" = "finance",
        "source" = "Test-1",
        .opts = list(ssl.verifypeer = FALSE))
    
    0 讨论(0)
  • 2020-12-08 18:21

    You need to install a SSL library.

    1. For windows you can get one here: Download "OpenSSL for Windows" version 0.9.8k

    2. Unzip to a temporary folder, and copy the files "libeay32.dll" and "ssleay32.dll" from the "bin" sub-folder to R\library\RCurl\lib\i386.

    3. Also you might copy it into the same directory as the R.exe.

    4. Then check if you have access to the https protocol:

      library(RCurl)
      curlVersion()$protocol 
      ## [1] "tftp"   "ftp"    "telnet" "dict"   "ldap"   "http"   "file"   "https"     
      ## [9] "ftps"   "scp"    "sftp"  
      
    5. Then install a new set of credential files:

      ca-bundle.crt can be found at : http://curl.haxx.se/ca/cacert.pem

      rename / copy to ca-bundle.crt

    6. Test with this:

      getURL("https://www.google.com/accounts/ClientLogin/?service=finance&email=me@gmail.com&Passwd=abcd&source=Test-1", 
             cainfo = "path to R/library/RCurl/CurlSSL/ca-bundle.crt")
      
    0 讨论(0)
提交回复
热议问题