hi all,
as title, how to do that?
var http = require('http');
var client = http.createClient(80, 'www.example.com'); // to access this url i need to put basic auth.
var request = client.request('GET', '/',
{'host': 'www.example.com'});
request.end();
request.on('response', function (response) {
console.log('STATUS: ' + response.statusCode);
console.log('HEADERS: ' + JSON.stringify(response.headers));
response.setEncoding('utf8');
response.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});
sorry if my question is not clear, my english bad ..
Thanks before :)