Skip to content

Can't send form-urlencoded #56

@orekav

Description

@orekav

Here I put TWO codes, the first WORKS perfectly
(it's correct when it says "captcha_error"... it is INCORRECT when it says " "error" ")

FIRST:
var http = require("http");
app.get('/obtenerCPA', (req, res) =>{
var options = {
host: 'www.correoargentino.com.ar',
path: '/sites/all/modules/custom/ca_forms_mobile/api/wsFacade.php',
port: '80',
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
};
var data = 'action=cpa&localidad=5001&calle=Corro&altura=122&provincia=C&g_recaptcha_response='';

var post_req = http.request(options, (response) => {
	response.setEncoding('utf8');
	response.on('data', function (chunk) {
		res.send(chunk);
  	});
});
post_req.write(data);
post_req.end();

});

SECOND:
app.get('/obtenerCPA2', (req, res) =>{
var data = 'action=cpa&localidad=5001&calle=Corro&altura=122&provincia=C&g_recaptcha_response='';

requestify.request('http://www.correoargentino.com.ar/sites/all/modules/custom/ca_forms_mobile/api/wsFacade.php',{
	method: 'POST',
	headers: {'Content-Type': 'application/x-www-form-urlencoded'},
	dataType: 'form-url-encoded',
	body: data
})
.then((response) => {
	console.log('Code Status:\t' + JSON.stringify(response.getCode()));
	res.send(response.getBody());
}),
(error) => {
	res.send(getCode());
}

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions