4
I’m trying to make a request https the Webservice of the São Paulo Public Treasury, but I don’t know where I’m going wrong.
This is the address:
http://www.fazenda.sp.gov.br/contas/webservice.shtm
According to the guidance of manual, no authentication is required.
Basically, I want the committed expense of a given year. My code is this one:
library(XML)
library(httr)
a<-GET('https://webservices.fazenda.sp.gov.br/WSTransparencia/TransparenciaServico.asmx?',
query = list(op="ConsultarDespesas",
ano="2015",
flagCredor=0,
flagEmpenhado=1,
flagLiquidado=0,
flagPago=0))
b<-xmlParse(a)
I get the following error:
Erro: 1: Opening and ending tag mismatch: p line 52 and br
2: Opening and ending tag mismatch: span line 49 and br
3: EntityRef: expecting ';'
4: Opening and ending tag mismatch: br line 43 and p
5: AttValue: " or ' expected
6: attributes construct error
7: Couldn't find end of Start Tag font line 85
8: Opening and ending tag mismatch: p line 85 and font
9: Opening and ending tag mismatch: span line 83 and p
10: AttValue: " or ' expected
11: attributes construct error
12: Couldn't find end of Start Tag font line 90
13: Opening and ending tag mismatch: pre line 87 and font
14: AttValue: " or ' expected
15: attributes construct error
16: Couldn't find end of Start Tag font line 97
17: Opening and ending tag mismatch: div line 41 and font
18: AttValue: " or ' expected
19: attributes construct error
20: Couldn't find end of Start Tag font line 98
21: Opening and ending tag mismatch: body line 39 and font
22: AttValue: " or ' expected
23: attributes construct error
24: Couldn't find end of
Can someone help me with that?
I already tried to do this request and could not. Here not error when I do
b <-xml2::read_html(content(a, "text"))
. But I don’t know if that answers.– Daniel Falbel
Hi Daniel, I solved the problem. I’ll put the answer below.
– José