Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Forked from technoweenie/gist:313114
Created February 24, 2010 05:27
Show Gist options
  • Save tim-smart/313132 to your computer and use it in GitHub Desktop.
Save tim-smart/313132 to your computer and use it in GitHub Desktop.
var sys = require("sys"),
http = require("http");
var google = http.createClient(80, "www.google.com");
var request = google.request("GET", "/", {"host": "www.google.com"});
request.addListener('response', function (response) {
response.setBodyEncoding("utf8");
var body = '';
response.addListener('data', function(chunk) {
body += chunk;
});
response.addListener('end', function() {
sys.puts('BODY: ' + body);
});
});
request.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment