Reputation: 166
I have tried using the proxy-checker package from NPM to check on proxies if they work and this code has been working fine so far:
var proxyChecker = require('proxy-checker');
proxyChecker.checkProxy("proxy.foo.com", 8080, {
// the complete URL to check the proxy
url: 'http://www.example.com',
// an optional regex to check for the presence of some text on the page
regex: /Example Domain/
},
function (host, port, ok, statusCode, err) {
console.log(host + ':' + port + ' => '
+ ok + ' (status: ' + statusCode + ', err: ' + err + ')');
}
)
but now I got to deal with authentication proxies which goes something like this
proxy:{
host:"proxy.foo.com",
port:8080,
user:"proxyuser",
password:"123"
}
What are the possible ways to implement authenticated proxies for a proxy checker?
Upvotes: 0
Views: 1547
Reputation: 410
you can provide the ip address in the format username:password@ip_address
var proxyChecker = require('proxy-checker');
proxyChecker.checkProxy("proxyuser:[email protected]", 8080, {
url: 'http://www.google.com',
},
function (host, port, ok, statusCode, err) {
console.log(ok)
})
Upvotes: 1