Created
September 1, 2010 20:58
-
-
Save ivarvong/561360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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