Skip to content

Instantly share code, notes, and snippets.

@ivarvong
Created September 1, 2010 20:58
Show Gist options
  • Save ivarvong/561360 to your computer and use it in GitHub Desktop.
Save ivarvong/561360 to your computer and use it in GitHub Desktop.
module = {name: "EMU Marketing Wiki",
description: "Web server for EMU Marketing documentation",
hostname: 'emumarketing.uoregon.edu',
path: '/wiki/index.php/Main_Page',
testString: 'Welcome to the EMU Marketing Wiki'};
var sys = require('sys'),
http = require('http');
var client = http.createClient(80, module.hostname);
var request = client.request('GET', module.path, {'Host': module.hostname});
request.end();
var responseBody = "";
request.on('response', function (response) {
response.setEncoding('utf8');
response.on('data', function (chunk) { responseBody += chunk; });
response.on('end', function() {
module['result'] = {'Success': new RegExp(module.testString,'g').test(responseBody)}; //
sys.puts(JSON.stringify(module));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment