Skip to content

Instantly share code, notes, and snippets.

@gjritter
Forked from neerajsingh0101/lab.js
Created March 31, 2010 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjritter/350417 to your computer and use it in GitHub Desktop.
Save gjritter/350417 to your computer and use it in GitHub Desktop.
var sys = require("sys"),
http = require("http");
data = '/';
url = 'www.google.com';
url = 'www.neeraj.name'
var con = http.createClient(80, url);
var request = con.request("GET", data, {'host': 'www.neeraj.name'});
request.addListener('response', function (response) {
sys.puts("STATUS: " + response.statusCode);
sys.puts("HEADERS: " + JSON.stringify(response.headers));
response.setBodyEncoding("utf8");
response.addListener("data", function (chunk) {
sys.puts("BODY: " + chunk);
});
});
request.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment