Created
June 29, 2018 08:03
-
-
Save sreepurnajasti/dae190c3d95009c3ccd93fb10fbdfcf7 to your computer and use it in GitHub Desktop.
Using request module with proxy
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 r = request.defaults({'proxy':'http://192.168.1.1:3128'}); | |
r('http://www.google.com', function (error, response, body) { | |
console.log('error:', error); // Print the error if one occurred | |
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received | |
console.log('body:', body); // Print the HTML for the Google homepage. | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment