2
I’m trying to access a service that returns an XML Description of service and there it says that I have to inform some parameters via POST. It’s the first time I’m having to do this and I’m not getting it. Someone can give a light?
2
I’m trying to access a service that returns an XML Description of service and there it says that I have to inform some parameters via POST. It’s the first time I’m having to do this and I’m not getting it. Someone can give a light?
1
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()
Browser other questions tagged node.js
You are not signed in. Login or sign up in order to post.
Take a look at this stackoverflow post in English https://stackoverflow.com/questions/6158933/how-to-make-an-http-post-request-in-node-js
– João Regis