Skip to content

Instantly share code, notes, and snippets.

@grampelberg
Created August 24, 2010 01:38
Show Gist options
  • Save grampelberg/546729 to your computer and use it in GitHub Desktop.
Save grampelberg/546729 to your computer and use it in GitHub Desktop.
var http = require('http');
var google = http.createClient(80, 'www.google.com');
var request = google.request('GET', '/',
{'host': 'www.google.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);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment