1
I set up a code to log into a website and download a spreadsheet, however, the connection has been closed, someone can help me?
library(RCurl)
curl = getCurlHandle()
curlSetOpt(verbose = T, cookiejar = 'cookies.txt', followlocation = TRUE, autoreferer = TRUE, curl = curl)
viewstate <- as.character(sub('.*id="_VIEWSTATE" value="([0-9a-zA-Z+/=]*).*', '\\1', html))
params <- list(
'UserName' = user_name,
'Password' = usr_password,
'submit' = 'Log on',
'_VIEWSTATE' = viewstate
)
html <- getURL('http://www.mcmconsultores.com.br/arearestrita/bancodedadositem/download/181', curl = curl)
login <- postForm('http://www.mcmconsultores.com.br/arearestrita/bancodedadositem/download/181', .params = params, curl = curl, style = 'POST')
When I put in the R, the R returns:
* Hostname www.mcmconsultores.com.br was found in DNS cache
* Trying 104.41.47.24...
* Connected to www.mcmconsultores.com.br (104.41.47.24) port 80 (#4)
> POST /arearestrita/bancodedadositem/download/181 HTTP/1.1
Host: www.mcmconsultores.com.br
Accept: */*
Referer: http://www.mcmconsultores.com.br/arearestrita/bancodedadositem/download/181
Content-Length: 26545
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue
< HTTP/1.1 100 Continue
< Via: 1.1 IM-FW-PX-018
< HTTP/1.1 500 Internal Server Error
< Via: 1.1 IM-FW-PX-020, 1.1 IM-FW-PX-018
< Connection: Keep-Alive
< Proxy-Connection: Keep-Alive
< Content-Length: 3038
< Date: Fri, 24 Feb 2017 17:46:13 GMT
< Content-Type: text/html; charset=utf-8
< Server: Microsoft-IIS/8.5
< Cache-Control: private
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
* HTTP error before end of send, stop sending
<
* Closing connection 4
Error: Internal Server Error