Skip to content

Instantly share code, notes, and snippets.

@friskfly
Created May 7, 2013 05:24
Show Gist options
  • Save friskfly/5530433 to your computer and use it in GitHub Desktop.
Save friskfly/5530433 to your computer and use it in GitHub Desktop.
var http = require("http");
function request(url) {
var options = {
hostname: url,
port: 80,
path: '/',
method: 'GET'
};
var req = http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
});
req.on('error', function(e) {
console.log(e + url);
});
req.end();
}
["www.qq.com", "www.163.com", "www.sina.com", "www.sohu.com"].forEach(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment