I'm trying to access a service that returns an XML Description of the service and there it says I have that inform some parameters via POST. It's the first time I'm having to do this and I can not do it. Can someone give a light?
I'm trying to access a service that returns an XML Description of the service and there it says I have that inform some parameters via POST. It's the first time I'm having to do this and I can not do it. Can someone give a light?
Using pure Node only, you can do something like this:
const querystring = require('querystring')
const https = require('https')
const postData = querystring.stringify({
txtLogin: 'login',
txtSenha: 'senha',
txtData: 'data'
})
const options = {
hostname: 'www.rad.cvm.gov.br',
port: 80,
path: '/DOWNLOAD/SolicitaDownload.asp',
method: 'POST'
}
const req = https.request(options, (res) => {
res.setEncoding('utf8')
res.on('data', (chunk) => {
console.log('Corpo: ${chunk}');
})
res.on('end', () => {
console.log('Nenhum dado a mais na resposta.');
})
})
req.on('error', (e) => {
console.error('Problemas no request: ${e.message}')
})
req.write(postData)
req.end()