Created
May 7, 2013 05:24
-
-
Save friskfly/5530433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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