<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Olá Daniel,<div><br></div><div>Agradeço muito pela ajuda! Ao executar o código, após inserir o nome de usuário e senha, recebo duas mensagens:</div><div><br></div><div>1:</div><div><div>> RCurl:::curlSetOpt(cookiejar="cookies.txt", useragent=browser, followlocation=TRUE, curl=curl)</div><div>An object of class "CURLHandle"</div><div>Slot "ref":</div><div><pointer: 0x0721dd20></div></div><div><br></div><div>2:</div><div><div>> login<-RCurl:::postForm(loginurl, .params=pars, curl=curl)</div><div>Mensagens de aviso perdidas:</div><div>In testCurlOptionsInFormParameters(.params) :</div><div> Found possible curl options in form parameters: username, password</div><div><br></div><div>3:</div><div><div>> dados<-download.file(url, destfile = "log2.txt"); dados</div><div>Erro em download.file(url, destfile = "log2.txt") : </div><div> esquema de URL não suportado</div></div><div><br></div><div><br></div><div><br></div>---<div><br></div><div>Atenciosamente,</div><div>Raphael Saldanha</div><div><br></div><div>rfsaldanha@outlook.com</div><br><br><div><hr id="stopSpelling">From: dmarcelino@live.com<br>Date: Fri, 14 Jun 2013 01:44:53 -0400<br>To: r-br@listas.c3sl.ufpr.br<br>Subject: Re: [R-br] RCurl<br><br><div dir="ltr">Raphael, eu acho que vai ser um pouco mais complicado do que eu imaginava. Veja que no site diz que o uso de cookies deve ser autorizado no seu navegador, então, o mesmo se aplica ao R. <div>A sua melhor estratégia deve ser criando 2 funções: (1) que execute o login guardando as informações de acesso (cookie); (2) fazer o download dos dados propriamente.</div>
<div><br></div><div>Obviamente não pude testar a solução abaixo porque não sou usuário do site.</div><div><br></div><div><br></div><div>####@ Exemplo @####<br></div><div><br></div><div><div>#Pagina links </div>
<div>loginurl = "<a href="http://ead.portalinstitutounibanco.org.br/login/index.php" target="_blank">http://ead.portalinstitutounibanco.org.br/login/index.php</a>"</div><div>dataurl = "<a href="http://ead.portalinstitutounibanco.org.br/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&id=149&user=0&date=0&modid=&modaction=0&logformat=downloadascsv" target="_blank">http://ead.portalinstitutounibanco.org.br/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&id=149&user=0&date=0&modid=&modaction=0&logformat=downloadascsv</a>"</div>
<div><br></div><div>#Dados da conta de acesso</div><div>pars=list(</div><div> username="Nome de usuário",</div><div> password="Senha",</div><div><span style="white-space:pre;"> </span> submitButton = "Acesso")</div>
<div><br></div><div><br></div><div>browser="Safari/5.0"</div><div><br></div><div>#pars</div><div>curl<-RCurl:::getCurlHandle()</div><div>RCurl:::curlSetOpt(cookiejar="cookies.txt", useragent=browser, followlocation=TRUE, curl=curl)</div>
<div><br></div><div>#Para fazer o login</div><div>login<-RCurl:::postForm(loginurl, .params=pars, curl=curl)</div><div><br></div><div># Baixar os dados</div><div>url<-RCurl:::getURL(dataurl, curl=curl)</div><div><br>
</div><div>dados<-download.file(url, destfile = "log2.txt"); dados</div></div><div><br></div><div>####@ FIM @####</div><div><br></div><div>Veja que o autor do pacote explica algo sobre como lidar com cookies aqui:</div>
<div><a href="http://www.omegahat.org/RCurl/RCurlJSS.pdf" target="_blank">http://www.omegahat.org/RCurl/RCurlJSS.pdf</a><br></div><div><br></div><div>Daniel</div><div><div><div><br></div></div><div><br></div></div></div><div class="ecxgmail_extra">
<br><br><div class="ecxgmail_quote">2013/6/12 Raphael Saldanha <span dir="ltr"><<a href="mailto:rfsaldanha@outlook.com" target="_blank">rfsaldanha@outlook.com</a>></span><br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">Olá Daniel,<div><br></div><div>Tentei o seguinte, já com o pacote carregado:</div><div><br></div><div><pre style="padding:5px;border:0px;font-size:13.600000381469727px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.600000381469727px;"><code style="padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;"><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">postForm</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">(</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">'<a href="http://ead.portalinstitutounibanco.org.br/login/index.php" target="_blank">http://ead.portalinstitutounibanco.org.br/login/index.php</a>'</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">,</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
username </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">=</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"Nome de usuário"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">,</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
password </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">=</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"Senha"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">,</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
submitButton </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">=</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"Acesso"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">,</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
style </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">=</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"POST"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">)</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
url </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"><-</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"<a href="http://ead.portalinstitutounibanco.org.br/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&id=149&user=0&date=0&modid=&modaction=0&logformat=downloadascsv" target="_blank">http://ead.portalinstitutounibanco.org.br/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&id=149&user=0&date=0&modid=&modaction=0&logformat=downloadascsv</a>"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">
download</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">.</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">file</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">(</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">url</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">,</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> destfile </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">=</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;"> </span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);">"log2.txt"</span><span style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">)</span></code></pre>
<div class="ecxim"><br>---<div><br></div><div>Atenciosamente,</div><div>Raphael Saldanha</div><div><br></div><div><a href="mailto:rfsaldanha@outlook.com" target="_blank">rfsaldanha@outlook.com</a></div><br><br></div><div><hr>
From: <a href="mailto:dmarcelino@live.com" target="_blank">dmarcelino@live.com</a><br>Date: Wed, 12 Jun 2013 13:39:08 -0400<br>To: <a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a><br>
Subject: Re: [R-br] RCurl<div class="ecxim"><br><br><div dir="ltr">Você pode passar um exemplo de como você está tentando?<div><br></div><div>Daniel</div></div></div><div><div class="ecxim"><br><br><div>2013/6/12 Raphael Saldanha <span dir="ltr"><<a href="mailto:rfsaldanha@outlook.com" target="_blank">rfsaldanha@outlook.com</a>></span><br>
<blockquote style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">Olá pessoal,<br><br>Estou tentando usar o pacote RCurl para logar em um site (plataforma moodle) e pegar alguns relatórios de acesso, mas não estou tendo sucesso. Alguém tem experiência com este pacote?<br>
<br>---<div><br></div><div>Atenciosamente,</div><div>Raphael Saldanha</div><div><br></div><div><a href="mailto:rfsaldanha@outlook.com" target="_blank">rfsaldanha@outlook.com</a></div> </div></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>
</div><div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:10pt;">\begin{signature}</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">Daniel Marcelino</span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;"><img title="Nuvem" alt="Nuvem"> </span><a href="mailto:dm.silva@umontreal.ca" style="font-family:arial;font-size:small;" target="_blank">dm.silva@umontreal.ca</a><span style="font-family:arial;font-size:10pt;"> </span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;"><img title="Telefone preto" alt="Telefone preto"> <a target="_blank">(514) 343 6111 #3799</a></span></font></div>
<div class="ecxim"><div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:13px;">Skype: d.marcelino </span></font></div>
<div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:10pt;">✎ 3200 Jean Brillant, Office C5071</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">Montreal, QC; H3T 1N8</span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;">Canada</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">\end{signature}</span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px;">
<font face="Verdana"><span style="font-family:arial;font-size:13px;"><br></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:13px;">"Small steps toward a much better world"</span></font></div>
</div></div>
<br>_______________________________________________
R-br mailing list
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forne�a c�digo m�nimo reproduz�vel.</div></div> </div></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>
<div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:10pt;">\begin{signature}</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">Daniel Marcelino</span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;"><img src="https://a.gfx.ms/emoji_02601.png" class="Emoji$02601$ABB RenderedEmoji" title="Nuvem" alt="Nuvem"> </span><a href="mailto:dm.silva@umontreal.ca" style="font-family:arial;font-size:small;" target="_blank">dm.silva@umontreal.ca</a><span style="font-family:arial;font-size:10pt;"> </span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;"><img src="https://a.gfx.ms/emoji_0260E.png" class="Emoji$0260E$ACF RenderedEmoji" title="Telefone preto" alt="Telefone preto"> (514) 343 6111 #3799</span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:13px;">Skype: d.marcelino </span></font></div>
<div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:10pt;">✎ 3200 Jean Brillant, Office C5071</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">Montreal, QC; H3T 1N8</span><br style="font-family:arial;font-size:small;">
<span style="font-family:arial;font-size:10pt;">Canada</span><br style="font-family:arial;font-size:small;"><span style="font-family:arial;font-size:10pt;">\end{signature}</span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px;">
<font face="Verdana"><span style="font-family:arial;font-size:13px;"><br></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px;"><font face="Verdana"><span style="font-family:arial;font-size:13px;">"Small steps toward a much better world"</span></font></div>
</div>
<br>_______________________________________________
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.</div></div> </div></body>
</html>