Skip to content

Instantly share code, notes, and snippets.

@clarkf
Created February 4, 2011 20:30
Show Gist options
  • Save clarkf/811710 to your computer and use it in GitHub Desktop.
Save clarkf/811710 to your computer and use it in GitHub Desktop.
var http = require('http'),
url = require('url');
function GET(path, cb) {
var url = url.parse(path),
data = '';
http.get({
host: url.hostname,
port: url.port,
path: url.pathname
}, function (resp) {
resp.on('data', function (chunk) {
data += chunk;
});
resp.on('end', function () {
cb(data);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment