Created
February 5, 2016 02:41
-
-
Save hongkongkiwi/ebdf1ad1c5e007a49f34 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
var request = require('request'); | |
var url1 = 'http://vanamco.com/ghostlab/'; | |
//var url = 'http://httpbin.org/get'; | |
var proxyUrl = 'http://127.0.0.1:3128'; | |
var proxiedRequest = request.defaults({'proxy': proxyUrl}); | |
console.log('Making a test request to',url1); | |
proxiedRequest(url1, function (error, response, body) { | |
if (error) return console.error(error); | |
if (!error && response.statusCode == 200) { | |
//console.log(body); // Show the HTML for the Google homepage. | |
console.log('Got 200 ok from server',url1); | |
} | |
if (response.statusCode !== 200) { | |
console.error('Got',response.statusCode,'back from server',url1); | |
console.log(body); | |
} | |
}); | |
var url2 = 'http://www.wowwee.com'; | |
console.log('Making a test request to',url2); | |
proxiedRequest(url2, function (error, response, body) { | |
if (error) return console.error(error); | |
if (!error && response.statusCode == 200) { | |
console.log('Got 200 ok from server',url2); | |
//console.log(body); // Show the HTML for the Google homepage. | |
} | |
if (response.statusCode !== 200) { | |
console.error('Got',response.statusCode,'back from server',url2); | |
console.log(body); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment