Skip to content

Instantly share code, notes, and snippets.

@neerajsingh0101
Created March 31, 2010 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neerajsingh0101/350369 to your computer and use it in GitHub Desktop.
Save neerajsingh0101/350369 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);
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