[R-br] Erro em Acesso ao Servidor - Pacote RCurl

Paulo Nogueira Starzynski paulons em gmail.com
Quinta Outubro 29 11:03:10 BRST 2015


Pessoal,
estou desenvolvendo um programa que realiza login em um servidor e depois
faz uma requisição POST. estava tudo funcionando bem durante o
desenvolvimento até que começou a retornar "Internal Server Error: 500" ao
fazer o POST.
Porém, quando eu acesso via browser, tudo funciona direito.

O fato de funcionar no browser indica necessariamente que o erro é no meu
código, certo? devem faltar opções de controle no objeto curl...

Meu código está abaixo, mas infelizmente não é reproduzĩvel porque o acesso
ao servido não é público. Mesmo assim, se alguém com familiaridade em curl
puder olhar e dar alguma idéia... testei configurar várias opções do curl e
nada contronou esse erro 500.

-----------
require(RCurl)

#------------------------------------------
curl <- getCurlHandle()
curlSetOpt(
  verbose = T,
  cookiejar = 'cookies.txt' ,
  followlocation = TRUE ,
  ssl.verifypeer = FALSE,
  useragent = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/44.0.2403.157 Safari/537.36',
  curl = curl
)

#------------------------------------------
# list parameters to pass to the website (pulled from the source html)
your.username <- 'usuario'
your.password <- 'senha'
params <-  list( 'txt_email' = your.username,  'txt_senha' = your.password)

# Realiza Login no Servidor
webAddr <- "http://hostname.br/dirname/ct_login.php"
login <- postForm(webAddr, .params = params, curl = curl, style = 'POST')
login

[1] "1{Sucesso controller{Login efetuado"
attr(,"Content-Type")
charset "text/html" "ISO-8859-1"

#------------------------------------------
# Realiza Busca
webBuscaId <- "http://hostname.br/dirname/executa_busca.php"
busca <- postForm(webBuscaId,
                 .opts = list(httpheader = c('Content-Type' =
'application/json', ssl.verifypeer = FALSE)),
                 .params = list('idConsulta' = '13678616F',
                                'adicPar' = 'formatoNulo'),
                 curl = curl, style="POST")

* Hostname was found in DNS cache
*   Trying 10.65.0.169...
* Connected to xxxxxx.xxxxxx.xxx.br (10.65.0.169) port 80 (#3)
> POST /xxxxx/executa_busca.php HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/44.0.2403.157 Safari/537.36
Host: xxxxx.xxxx.xxx.br
Accept: */*
Cookie: PHPSESSID=3dug68beqvmgpe0v19cc78a947
Content-Type: application/json
ssl.verifypeer: FALSE
Content-Length: 28

* upload completely sent off: 28 out of 28 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Thu, 29 Oct 2015 12:53:27 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Pragma: no-cache
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=ISO-8859-1
<
* Closing connection 3
Error: Internal Server Error
>




Abraços,
Paulo
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20151029/b595bc8b/attachment.html>


Mais detalhes sobre a lista de discussão R-br