Obter conteúdo do site sobre SSL com httr em R

Estou tentando buscar uma matriz JSON do meu servidor usando o método HTTP POST em R.

Eu tentei usar tanto oPOSTfunção dehttre agetURLfunção deRCurl mas ambos retornam erros.

cafile <- system.file("CurlSSL", "cacert.pem", package = "RCurl")
url    <- "https://example.com/query/getData.php"

POST(url,body=NULL)
POST(url,body=NULL,config(cainfo=cafile))

getURL(url)
getURL(url,cainfo=cafile)

O erro dado peloPOST A função é (para ambas as chamadas):

Error in curl::curl_fetch_memory(url, handle = handle) : 
  SSL peer certificate or SSH remote key was not OK

O erro dado pelogetURL função é (semconfig(cainfo=cafile)):

* Hostname was NOT found in DNS cache
*   Trying 162.xxx.xxx.xxx...
* connect to 162.xxx.xxx.xxx port 443 failed: Connection refused
*   Trying 130.yyy.yyy.yyy...
* Connected to example.com (130.yyy.yyy.yyy) port 443 (#0)
* found 175 certificates in /etc/ssl/certs/ca-certificates.crt
* gnutls_handshake() warning: The server name sent was not recognized
* failed to get server cert
* Closing connection 0
Error in function (type, msg, asError = TRUE)  : 
  gnutls_handshake() warning: The server name sent was not recognized

Eu suspeito que isso tem algo a ver com o R desde a execução:

curl 'htt,ps://example.com/query/getData.php'

da linha de comando retorne o resultado esperado.

O servidor é um servidor apache2 com certificado SSL COMODO. No/etc/apache2/sites-enabled/000-default.conf o nome do servidor está definido como

ServerName www.example.com  

Qualquer ajuda seria muito apreciada

questionAnswers(2)

yourAnswerToTheQuestion