Revision: 39346
Updated Code
at January 16, 2011 11:24 by mecha
Updated Code
var http = require('http'); var fs = require('fs'); var mySite = 'jonlabelle.com'; var myClient = http.createClient(80, mySite); var myRequest = myClient.request('GET', '/', { 'host': mySite }); myRequest.end(); myRequest.on('response', function(response) { console.log('STATUS: ' + response.statusCode); console.log('HEADERS: ' + JSON.stringify(response.headers)); response.setEncoding('utf8'); response.on('data', function(chunk) { fs.writeFile(mySite + '.html', chunk); console.log('BODY: ' + chunk); }); });
Revision: 39345
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 16, 2011 11:21 by mecha
Initial Code
var http = require('http'); var fs = require('fs'); var mySite = 'jonlabelle.com'; var myClient = http.createClient(80, mySite); var myRequest = myClient.request('GET', '/', { 'host': mySite }); myRequest.end(); myRequest.on('response', function(response) { console.log('STATUS: ' + response.statusCode); console.log('HEADERS: ' + JSON.stringify(response.headers)); response.setEncoding('utf8'); response.on('data', function(chunk) { fs.writeFile(mySite + '.html', chunk); console.log('BODY: ' + chunk); }); });
Initial URL
Initial Description
Initial Title
HTTP Response to file with Node
Initial Tags
javascript
Initial Language
JavaScript