totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 449 forks source link

curl using utils.request #207

Closed goldalworming closed 10 years ago

goldalworming commented 10 years ago

hi peter, how to use curl with these headers from utils.request https://www.online-clipboard.com/141232138823640bf27a52823d57x28/ I failed every time to login to server..

petersirka commented 10 years ago

Hi @goldalworming,

var headers = {};

headers['User-Agent'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0';
headers['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
headers['Accept-Language'] = 'en-US,en;q=0.5';
headers['Accept-Encoding'] = 'gzip, deflate';
headers['Referer'] = 'https://ibank.klikbca.com/';
headers['Cookie'] = 'ARPT=R3534516605; JSESSIONID=1707JnNBdT0J392cQPyG7026hn0Pn7Lnw7pgQcKMQtnTNPC5S3zZ!-1681179253; ___d26954=%7B%22v4a%22%3A%7B%22r%22%3A%220%22%7D%2C%22v4b%22%3A%7B%22f%22%3A%220%22%7D%2C%22v7%22%3A%7B%22s%22%3A%22%22%7D%2C%22v4%22%3A%7B%22j%22%3A%22%22%7D%2C%22timestamp%22%3A%222014-10-03%2007%3A13%3A30%22%2C%22ki%22%3A%221%22%2C%22v6%22%3A%7B%22u%22%3A%22%22%2C%22k%22%3A%22bca.1.20130617-1%22%7D%7D%7C%7C9268a03668844c9c4b2e4e327c3d440d8031d72ab395b5540decf6a40bd0752f; ___u26954=NmIwMTNkYTRmODhkYTkxMDk0MTQ4MWViZDRmMzYzZjUwMGY1MmMwODYxMjY3ZTcyNmU5ODVmNzI4MWNlNjkyOTQxMTc5YjNiNTBkNWVmMzk1NjhlZjgyNDIwMmVjNDkzZTA4NGVhZmY5YWVlYmIwODg5Y2NmNzI2MTRjYTliZTc1ZjkyMGM4ZTdkMDA0MjAzNGI5NmUzOTQ3NDgwMWFmMjQ1YzgxZDQ1ZTdkODZjMWRlMTc3ZWU4ZTQ4MGNiYzdhNWQxNGJlMjRhODE5YzljNzMxNjcwNTYwZDM5NWQyZjY0ZjUxYzUwOTBhNTFlNWNkYWUwODkzOGNkYzc4NzljZTY3MzJlYzk4NDMyMTRkMTM3ZmEzMTg5OGVlYjYzMmU1M2YyNjc1NzliMmZkYzdhY2QwNzA2ZjUzNjBiM2NmYzYxZDc5ZDg2NTEwNTY0NjQyZDI4NjE0N2NlYWJhZDJmODIwZTViN2FmMjZmOTgzNTJjM2M3YTFhNzk3MjFiNTVlMWU5NDAzNjg1Yzc5N2Y2OWYyYzU0MWNmOTcyYWFhNTA3NzY3OTliZjcyNGU5OTY4ZTFmNWRjMGQxMDFlODg0Yzg4OGNjOTEwNTg0M2FmMDJmY2FhZjc4NzlhZDcwM2M5ZTQ5NjBhODg4ZTgyMGNkNzYyMDY5YjQzNzBjODdhMjJ8MXxpQmFua0Zvcm0%3D';
headers['Content-Type'] = 'application/x-www-form-urlencoded';

Utils.request('URL', ['post'], 'POSTDATA=value%28actions%29=login&value%28user_id%29=ariefnurxxxx&value%28user_ip%29=223.255.230.55&value%28pswd%29=xxxxxx&value%28Submit%29=LOGIN', function(err, data, status) {
    console.log(err, data, status);
}, null, headers);

thanks.